1.ajax
$.ajax({
url:"http://www.microsoft.com", //請求的url位址
dataType:"json", //傳回格式為json
async:true,//請求是否異步,預設為異步,這也是ajax重要特性
data:{"id":"value"}, //參數值
type:"GET", //請求方式
beforeSend:function(data){
//請求前的處理
},
success:function(req){
//請求成功時處理
},
complete:function(data){
//請求完成的處理
},
error:function(data){
//請求出錯處理
}
});
get
$.get("url",{id:1},function(data){
})
post
$.post("url",{id:1},function(data){
})