日期:2014-05-16 浏览次数:20363 次
ar obj = { item: {item1:1,item2:2}
};
var arg = JSON.stringify(obj);
$.ajax({
type: "Post",
datatype: "json",
url: "http://pc1234567/Service/Service1.svc/hello",
data: arg,
contentType: "application/json; charset=utf-8",
beforeSend: function (xhr) {
xhr.setRequestHeader("Accept", "application/json")
},
success: function (data, textStatus, xhr) {
if (data != null) {
$("#txtmsg").val(data.msg);
}
},
error: function (xhr, textStatus, errorThrown) {
alert(xhr.responseText);
}
});