$.ajax({ url:'city/userInfo.action', type: 'POST', dataType: 'text', data: {name:"lixueli"}, timeout: 1000, error: function(){ alert('Error loading XML document'); }, success: function(data){ alert(data); } });
JQuery发送post请求
$.post( url:"test.php", data:{ "func": "getNameAndTime" }, success:function(data){ alert(data.name); // John console.log(data.time); // 2pm }, type:"json" );
JQuery发送get请求
$.get( utl:"test.cgi", date:{ name: "John", time: "2pm" }, error:function(data){ alert("Data Loaded: " + data); }, success:function(data){ alet(date); } );