Jquery 常用ajax调用方法
$.ajax({
type:"post",
dataType:"JSON",contentType: "application/json; charset=utf-8",
cache:false,
async:false,
data:{id:1},//传递参数
url:"xxxxxx",
brforeSend:function(){},
complete:function(XMLHttpRequest,textStatus){},
success:function(data){
//回调函数
alert(data);
},
error:function(){}
});
$.post("xxxxxx",{name:'account'},function(data){
//回调函数
alert(data);
},"JSON");
Jquery 常用ajax Jsonp 调用方法
client:
$.ajax({
type:"get",
url:"xxxxxx",
dataType:"jsonp",
data:{id:1},
jsonp:"jsonpcallback",
jsonpCallback: "success_jsonpCallback",
success:function(data){
//回调函数
alert(data);
},
error:function(){}
});
Server:
Response.Write(Request["jsonpcallback"]+"({msg:1})");