jQuery Ajax ʵÀýÑÝʾ
<html>
<head>
<title>jQuery Ajax ʵÀýÑÝʾ</title>
</head>
<script language="javascript" src="../lib/jquery.js"></script>
<script language="javascript">
$(document).ready(function ()
{
$('#send_ajax').click(function (){
var params=$('input').serialize(); //ÐòÁл¯±íµ¥µÄÖµ
$.ajax({
url:'ajax_json.php', //ºǫ́´¦Àí³ÌÐò
type:'post', //Êý¾Ý·¢ËÍ·½Ê½
dataType:'json', //½ÓÊÜÊý¾Ý¸ñʽ
data:params, //Òª´«µÝµÄÊý¾Ý
success:update_page //»Ø´«º¯Êý(ÕâÀïÊǺ¯ÊýÃû)
});
});
//$.post()·½Ê½£º
$('#test_post').click(function (){
$.post(
'ajax_json.php',
{
username:$('#input1').val(),
age:$('#input2').val(),
sex:$('#input3').val(),
job:$('#input4').val()
},
function (data) //»Ø´«º¯Êý
{
var myjson='';
eval('myjson=' + data + ';');
$('#result').html("ÐÕÃû:" + myjson.username + "<br/>¹¤×÷:" + myjson['job']);
}
);
});
//$.get()·½Ê½£º
$('#test_get').click(function ()
{
$.get(
'ajax_json.php',
 
Ïà¹ØÎĵµ£º
¹ØÓÚajaxµÄÃû×Ö
ajax µÄÈ«³ÆÊÇAsynchronous JavaScript and XML£¬ÆäÖУ¬Asynchronous ÊÇÒì²½µÄÒâ˼£¬ËüÓбðÓÚ´«Í³web¿ª·¢ÖвÉÓõÄͬ²½µÄ·½Ê½¡£
¹ØÓÚͬ²½ºÍÒì²½
Òì²½´«ÊäÊÇÃæÏò×Ö·ûµÄ´«Ê䣬ËüµÄµ¥Î»ÊÇ×Ö·û£»¶øÍ¬²½´«ÊäÊÇÃæÏò±ÈÌØµÄ´«Ê䣬ËüµÄµ¥Î»ÊÇè壬Ëü´«ÊäµÄʱºòÒªÇó½ÓÊÜ·½ºÍ·¢ËÍ·½µÄʱÖÓÊ ......
ASP.NET,AJAXÎļþÉÏ´«µÄÒÉÎÊ
Ô±¾ÒÔΪÓÃÕâÖÖ·½Ê½£¬°Ñ´Ë·½·¨·Åµ½Ò»¸öHttphandlerÖУ¬È»ºó´ÓJAVASCRIPT·ÃÎÊHttphandlerÀ´ÊµÏÖÎÞˢеÄÎļþÉÏ´«¡£Ã»Ïëµ½£¬ÕâÑùͬÑùÊDz»Ðеģ¬Ö»ÄÜÔÚ±¾»ú²âÊÔͨ¹ý£¬Èç¹û·Åµ½ÍøÉÏ£¬»òÕß´ÓÆäËûµØ·½·ÃÎʾͻáÌáʾÎÞ·¨ÕÒµ½Îļþ£¬¿É¼ûÔÚASP.NETÖÐËüÖ»ÄÜÓÃÓÚÉÏ´«·þÎñÆ÷¶ËµÄÎļþ¡£
֮ǰÔÚÍøÕ¾Ò²Ë ......
½ñÌì³õ´Î½Ó´¥AjaxÄÇôÎÒ½«ÎÒµÄѧϰ¼Ç¼ÏÂÀ´£¬×î½ü¼ÇÐÔ²»Ì«ºÃ¡£±¸Íü°É
1¡¢Ê×ÏÈ´ÓÍøÂ·ÉÏÏÂÔØAjaxÀ©Õ¹°ü£¬VS2008Ö»ÊÇ´ø×Å×î»ù´¡µÄÈý¸öAjax¿Ø¼þ¡£ÄÇôÎÒÃÇÏÂÔØAjaxControlToolkit¿Ø¼þ£¬½«ÏÂÔØºóµÄѹËõ°ü½âѹ¡£ÕÒ³öAjaxControlToolkit.dllËùÔÚλÖá£
2¡¢ÔÚVS2008ÖУ¬ËæÒâÕÒÒ»¸öÑ¡Ï£¬»òÕߣ¬Ð½¨Ò»¸öÑ¡ÏÀ´·ÅÈëÎÒÃÇËù¼ÓÈëµÄ ......
1£ºAjax¿ÉÒÔͨ¹ýJavaScriptµÄXMLHttpRequest¶ÔÏóÓë·þÎñÆ÷½øÐÐͨÐÅ£¬Í¨¹ýXMLHttpRequest£¬JavaScript¿ÉÒÔÔÚ²»ÖØÔØÒ³ÃæµÄÇé¿öÏÂÓë·þÎñÆ÷½øÐÐͨÐÅ¡£
2£ºXMLHttpRequest ä¯ÀÀÆ÷Ö§³Ö
<script type="text/javascript">
function ajaxFunction()
{
var xmlHttp;
try
{
xmlHtt ......
Ajax½éÉÜ
AJAX - ä¯ÀÀÆ÷Ö§³Ö
AJAX µÄÒªµãÊÇ XMLHttpRequest ¶ÔÏó¡£²»Í¬µÄä¯ÀÀÆ÷´´½¨ XMLHttpRequest ¶ÔÏóµÄ·½·¨ÊÇÓвîÒìµÄ¡£IE ä¯ÀÀÆ÷ʹÓà ActiveXObject£¬¶øÆäËûµÄä¯ÀÀÆ÷ʹÓÃÃûΪ XMLHttpRequest µÄ JavaScript ÄÚ½¨¶ÔÏó¡£ÈçÐèÕë¶Ô²»Í¬µÄä¯ÀÀÆ÷À´´´½¨´Ë¶ÔÏó£¬ÎÒÃÇҪʹÓÃÒ»Ìõ "try and catch" Óï¾ä¡£
<script type="t ......