所以,我有我的目标我想以JSON格式发送(模型)创建JSON对象(试图)
function SerachClient() {
var tempfirstname = $("#firstname").val();
var templastname = $("#lastname").val();
var tempmobile = $("#mobile").val();
var tempaccountId = $("#AccountId").val();
var tempPin = "1234";
var model = { LastName: templastname, FirstName: tempfirstname, Mobile: tempmobile, AccountId: tempaccountId, Pin: tempPin }
$.ajax({
url: "/Home/SearchClient/",
type: 'GET',
data: { model: JSON.stringify(model) },
cache: false,
crossDomain: true,
async: true,
dataType: 'json',
success: function (data) {
},
error: function (event) {
},
headers: {
'Access-Control-Allow-Origin': '*'
},
}).done(function() {
});
}
然而
我的asp.net mvc的控制器上它看到
public JsonResult SearchClient(string model)
{
}
model=%7B%22LastName%22%3A%22Smith%22%2C%22FirstName%22%3A%22John%22%2C%22Mobile%22%3A%2278121212166%22%2C%22AccountId%22%3A%224e82dbfe-2b7f-472c-b66c-0707b1d66ba2%22%2C%22Pin%22%3A%221234%22%7D&_=1469706173642
任何想法为什么它的格式不正确?
谢谢... :) –