Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JqueryµÄAJAXʹÓùý³ÌÖеÄÌå»á

<mce:script type="text/javascript"><!--
function login(){
var postURL = "http://localhost:8080/cas/simpleLogin";
var params = {
"loginUrl":$("#loginUrl").val(),
"service":$("#service").val(),
"login":$("#login").val(),
"username":$("#username").val(),
"password":$("#password").val(),
"submit":$("#submit").val()
};
$.ajax({
type: "POST",
url: postURL,
dataType: "html",
data: params,
timeout: 20000,
error: function() {
alert("Error");
},
success: function(text) {
if(text=="error"){
alert("loginFailed!!!");
}else if(text=="success"){
alert("loginSuccess!!!");
}else{

}
}
});
}

// --></mce:script>
ÉÏÊöÕâ¶Î´úÂëÊÇJquery ÔÚÒ³ÃæʹÓÃAjaxµÄÊÂÀý£¬POSTURLÊÇajaxÇëÇóµÄµØÖ·£¬¶øsuccess ºÍerror ¶ÔÓ¦µÄfunctionΪ»Øµ÷º¯Êý£¨success error ´ú±í·µ»ØÊý¾ÝµÄÀàÐ͵±·µ»ØÊý¾ÝµÄÀàÐͲ»ÊǶ¨ÒåµÄ¾ÍÖ´ÐÐerrorÄǸö»Øµ÷º¯Êý·ñÔòÖ´ÐÐsuccessÄǸöº¯Êý£©£¬Ò»°ãÀ´ËµÎÒÃÇͨ³£ÊÇÔÚPOSTURLÖÐдÈëij¸öaction´Ó¶ø·¢³öÇëÇ󣬺ǫ́µÄaction»á·µ»ØһЩ¶ÔÏóÈçjson£¬ÕâʹµÃÎÒ¶ÔAjaxµÄÀí½â¾ÖÏÞÓÚÈÏʶajaxÖ»ÄÜÇëÇóÒ»¸öactionÈ»ºóͨ¹ý¸Ãaction·µ»Ø¸øÎÒÖµ£¬¼´ÆÕͨģʽµÄÇëÇó¡£
ͨ¹ý¿ª·¢ÏµÍ³µÄʱºòÓÉÓÚÒªÕûºÏCASËùÒÔÎÒµÄaction²»ÊÇͬһ¸öapplictionµÄurl ¶øÊÇÁíÒ»¸öCASServer Application µÄurl ͨ¹ýʵÑéÁ˽⵽postURL¿ÉÒÔд³Éhttp://localhost:8080/cas/simpleLogin ¶øͨ¹ý°ÑÇëÇó·¢µ½Õâ¸öflow µÃµ½·µ»ØÖµ¡£ÆäÖзµ»ØÖµÊÇÒ»¸öÒ³Ãæ¡£ÓÉÓÚCASServerÊÇ»ùÓÚspring MVC дµÄ£¬²»Äܶ¨ÒåËýµÄ·µ»ØÀàÐÍ£¬Òò´ËÖ»ÄÜ·µ»Ø


Ïà¹ØÎĵµ£º

Ajaxµ¯³öʾÀý ¿É¿ØÖÆʱ¼ä×ÔÓÉÇл»ºÍ¹Ø±Õ

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajaxµ¯³öʾÀý-¿É¿ ......

jquery+ajax+json+asp.netѧϰ±Ê¼Ç£¨Ò»£©

jqueryÖÐÒѾ­·â×°ÁËajaxµÄ¹ý³Ì£¬Ê¹ÓÃÆðÀ´ºÜ¼òµ¥£º
ͨ¹ýget·½Ê½Ìá½»£º
<html>
<head>
    <title>ʵÏÖ·þÎñÆ÷ʱ¼äʵʱ±ä»¯</title>
    <script language="javascript" type="text/javascript" src="js/jquery-1.3.1.js"></script>
  & ......

php µÄ ajax ʵÏÖ

<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<input type="button" onclick="test();" value="Ìá½»"/>
<script type="text/javascript">
    function test(){
            var valid = {
& ......

AJAX±íµ¥Ìá½»·½·¨£¨JSON£©

AJAX±íµ¥Ìá½»·½·¨£¨JSON£©
1./*****JAVA**************************************************************/
JAVAÀàÖУº
 
/*****JAVA**************************************************************/
2./*****struts.xml**************************************************************/
struts.xmlÎļþÖУº ......

jQueryÖ®Ajax·½·¨

1 . jQuery°ïÖúÖ®AjaxÇëÇó£¨Ò»£©jQuery.ajax(options)
Òý×Ô:http://www.flywe.net/article/javascript/jQuery_ajax.html
             jQuery.ajax(options)
      Í¨¹ý HTTP ÇëÇó¼ÓÔØÔ¶³ÌÊý¾Ý¡£
    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ