jQuery中Ajax的全局设定$.ajaxSetup()

jQuery中Ajax的全局设定$.ajaxSetup()

$. ajaxSetup({
    //全局设定
    url:"a.html",
    success: function(data){
         $("#serverResponse").html( decodeURI(data));   
     }
})
function doRequestUsingGET(){
 $.ajax({
  data: createQueryString(),
  type: "GET"
 });
}
function doRequestUsingPOST(){
 $.ajax({
  data:"firstName="+firstName+"&birthday="+birthday;
  type: "POST"
 });
}

你可能感兴趣的:(jQuery中Ajax的全局设定$.ajaxSetup())