获取空的json对象 [英] Getting Empty json object
本文介绍了获取空的json对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有
<button type="button" class="CleanButton" name="exportLink" onclick="ValidateOrder();">
Complete
</button>
我的JavaScript看起来像是
my javascripts looks like,
function ValidateOrder() {
var jsonObject = { "EmployerName": $("#EmployerName").val(), "Address1": $("Address1").val(), "Address2": $("Address2").val(), "City": $("City").val(), "State": $("State").val(), "City": $("City").val() };
$.ajax({
url: "/Verification/CompleteOrder",
type: "POST",
datatype: "json",
data: JSON.stringify(jsonObject),
contenttype: "application/json; charset=utf-8",
success: function (mydata) {
alert("success");
},
error: function () {
alert("fail");
}
}); }
而且我的控制器看起来像
and my controller looks like
[HttpPost]
public ActionResult CompleteOrder(string jsonData)
{
return RedirectToAction("Index", "Orders");
}
但是我得到的是空的json对象,我有什么遗漏吗?
Rachana
But I am getting empty json object , am I missing anything?
Rachana
推荐答案
(" ).val()," :
("#EmployerName").val(), "Address1":
(" ).val()," Address2":
("Address1").val(), "Address2":
( 地址2").val(), 城市" :
("Address2").val(), "City":
这篇关于获取空的json对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文