我通过$ .ajax在Controller上发送stringify代码,收到404错误 我的Stringify数据在
之下{
"KeywordID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "EvaluateExpression",
"OutputType": "Double",
"Description": "To Evaluate the given expression",
"AssociatedMethod": "method_Eval",
"KeywordType": "SystemKeyword",
"KeywordClass": "Mathematical Operation",
"PluginID": "00000000-0000-0000-0000-000000000000",
"PluginName": "SystemKeyword",
"OutputDescription": "Returns the result of evaluated expression.",
"Deprecation_Reason": "",
"KeywordInputParameterDTOs": [
{
"Arg_ID": "9d617217-f5bd-4e2e-8df6-84c5319c353f",
"Keyword_ID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "Operand1",
"description": "Operand1",
"ENUM_DataType": "Double",
"Position": 0
},
{
"Arg_ID": "841541ca-2b8e-4345-966a-7dcb1510deab",
"Keyword_ID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "Operand2",
"description": "Operand2",
"ENUM_DataType": "String",
"Position": 1
},
{
"Arg_ID": "09c55ad7-8902-4706-9698-d8d30787fd46",
"Keyword_ID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "Operand3",
"description": "Operand3",
"ENUM_DataType": "Double",
"Position": 2
},
{
"Arg_ID": "95f14ec3-c22d-45de-9117-82803b8c425c",
"Keyword_ID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "Operand4",
"description": "Operand4",
"ENUM_DataType": "String",
"Position": 3
},
{
"Arg_ID": "b4783adf-bf05-4f81-a83c-532f78f305fc",
"Keyword_ID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "Operand5",
"description": "Operand5",
"ENUM_DataType": "Double",
"Position": 4
},
{
"Arg_ID": "fbcce45c-d490-4db8-9726-0200d64eaf21",
"Keyword_ID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "Operand6",
"description": "Operand6",
"ENUM_DataType": "String",
"Position": 5
},
{
"Arg_ID": "2094021e-cf89-4145-a962-9601e695c11d",
"Keyword_ID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "Operand7",
"description": "Operand7",
"ENUM_DataType": "Double",
"Position": 6
},
{
"Arg_ID": "f3044286-bbbf-41fd-a400-a61675d3d981",
"Keyword_ID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "Operand8",
"description": "Operand8",
"ENUM_DataType": "String",
"Position": 7
},
{
"Arg_ID": "5b096737-ad8f-4c21-bf30-accf67c21cde",
"Keyword_ID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "Operand9",
"description": "Operand9",
"ENUM_DataType": "Double",
"Position": 8
},
{
"Arg_ID": "f0f656ae-0adf-4646-a94a-13cd9e3925f7",
"Keyword_ID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "Operand10",
"description": "Operand10",
"ENUM_DataType": "String",
"Position": 9
},
{
"Arg_ID": "c33e4a37-26d3-4e44-a1fb-897d16e3e31c",
"Keyword_ID": "fb66aacc-c643-43fa-9da1-d6dc714cdeab",
"Name": "Operand11",
"description": "Operand11",
"ENUM_DataType": "Double",
"Position": 10
}
]
}
我的AJAX代码在这里
function demo(data) {
debugger
var treeBinding =arrayToObjectString(data)
$.ajax({
url: '/Flow/demo',
type: "GET",
data: { dd: treeBinding },
success: function (res) {
},
error: function (error) {
//alert('error : ' + json.stringify(error));
}
});
}
当我尝试仅发布此数据样本时,我收到404错误。请告诉我一些解决方案。
答案 0 :(得分:0)
尝试发送:
JSON.stringify(yourData)
答案 1 :(得分:0)
检查ajax中的url是否与后面的代码相同。这是导致404错误的一个主要原因。
答案 2 :(得分:0)
使用contentType: "application/json;charset=utf-8"
和data:treeBinding
,如下所示。希望这能解决你的问题。
function demo(data) {
var treeBinding =arrayToObjectString(data)
$.ajax({
url: '/Flow/demo',
type: "GET",
data: treeBinding,
contentType: "application/json;charset=utf-8"
success: function (res) {
},
error: function (error) {
//alert('error : ' + json.stringify(error));
}
});
}