标签:
|
1
2
3
4
5
6
7
|
$.ajax({ method: "POST", url: "some.php", data: { name: "John", location: "Boston" }}).done(function( msg ) { alert( "Data Saved: " + msg );}); |
|
1
2
3
4
5
6
|
$.ajax({ url: "test.html", cache: false}).done(function( html ) { $("#results").append(html);}); |
false,防止自动转换数据格式。 |
1
2
3
4
5
6
7
8
|
var xmlDocument = [create xml document];var xmlRequest = $.ajax({ url: "page.php", processData: false, data: xmlDocument});xmlRequest.done(handleResponse); |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
var menuId = $("ul.nav").first().attr("id");var request = $.ajax({ url: "script.php", method: "POST", data: {id : menuId}, dataType: "html"});request.done(function(msg) { $("#log").html( msg );});request.fail(function(jqXHR, textStatus) { alert( "Request failed: " + textStatus );}); |
1 $.ajax({ 2 method: "GET", 3 url: "service.php", 4 dataType: "json", 5 success:function(){}, 6 error:function(){} 7 });
|
1
2
3
4
5
|
$.ajax({ method: "GET", url: "test.js", dataType: "script"}); |
标签:
原文地址:http://www.cnblogs.com/vanstrict/p/5658112.html