ajax请求方式

//1、get
$.ajax({
  type: "GET",
  url: "test.js",
    success: function(msg){
     alert( "Data Saved: " + msg );
   }
});

//2、post
$.ajax({
   type: "POST",
   url: "some.php",
   data: "name=John&location=Boston",
   success: function(msg){
     alert( "Data Saved: " + msg );
   }
});

post请求方式

$.post({
    url: "test.php",
    data:{ name: "John", time: "2pm" },
    success:function(data){
          alert( data );
    }
});  

get请求方式

$.get({
    url: "test.php",
    data:{ name: "John", time: "2pm" },
    success:function(data){
          alert( data );
    }
});