If you want to send the data as json then use the $.ajax function
You can specify type post and dataType json.
$.ajax({
url: "mydomain.com/url",
type: "POST",
dataType: "xml/html/script/json", // expected format for response
contentType: "application/json", // send as JSON
data: $.param( $("Element or Expression") ),
complete: function() {
//called when complete
},
success: function() {
//called when successful
},
error: function() {
//called when there is an error
},
});
Taken from ajax documentation
http://api.jquery.com/jQuery.ajax/
contentTypeString
Default: 'application/x-www-form-urlencoded; charset=UTF-8'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…