【发布时间】:2015-04-14 17:02:40
【问题描述】:
这是我的 jQuery 代码
接下来是我的 json 函数来处理这个名为 InsertMatlabJson 的 jquery 代码。
问题是 .NET json 函数中没有文本。 . .
function insert() {
var url = '<%=Url.Content("~/") %>' + "Matlab/InsertMatlabJson";
var text = document.getElementById('MainContent_FreeTextBox1').value
$.ajax({
url: url,
type: 'GET',
data: { text: text},
contentType: 'application/json; charset=utf-8',
success: function (response) {
//your success code
alert("opk");
},
error: function () {
//your error code
alert("no");
}
});
}
public JsonResult InsertMatlabJson(string text)
{
}
【问题讨论】:
-
你想通过查询发送html并作为文本变量在函数上接收吗?
-
您的问题是,在 ASP.NET MVC 中您没有收到 text 参数中的任何内容吗?
-
尝试将:type: 'GET' 改为 type: 'POST'
-
是的,我收到简单的文本(嗨)!;但我不收到(
嗨
); -
我朋友的任何方式都不起作用:-(
标签: javascript c# jquery json asp.net-mvc