1
所以我的問題問:是$。阿賈克斯()縮短正常碼 (這些都是不同的例子,因爲我的問題是關於剛剛結構) 是
$.ajax(
{url:"index.php/a",
type:"POST",
contentType:"application/json; charset=utf-8",
data:{some_string:"blabla"},
dataType:"json",
success:function(data){
alert(data);
},
error:function(a,b,c){
}
});
的jQuery的方式
一樣
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
}