我通过 ajax 将数据发布到 aspx 页面,现在我不知道如何阅读它。我只需要获取通过 JSON 传递的字符串并将它们分配给某些变量并操作 .aspx 文件中的变量。我该怎么做呢?
这是jQuery:
var ceSaveDatea = {};
ceSaveDatea.one = requestNumber;
ceSaveDatea.two = itemTypeID;
ceSaveDatea.three = servicesRequired;
ceSaveDatea.four = otherComments;
ceSaveDatea.five = suggestedReplacements;
ceSaveDatea.six = internalTestingRequired;
ceSaveDatea.seven = externalTestingRequired;
ceSaveDatea.eight = ceGeneralComments;
/*
var url = "../ajaxURLs/ComponentEngineering.aspx?requestNumber=" + requestNumber + "&itemTypeID=" + itemTypeID + "&servicesRequired=" + servicesRequired + "&otherComments=" + otherComments + "&suggestedReplacements=" + suggestedReplacements + "&internalTestingRequired=" + internalTestingRequired + "&externalTestingRequired=" + externalTestingRequired + "&ceGeneralComments=" + ceGeneralComments;
var encodedURL = EncodeURL(url);
*/
$.ajax({
type: "POST",
url: "/ajaxURLs/ComponentEngineering.aspx",
data: JSON.stringify(ceSaveDatea),
contentType: "application/json; charset=utf-8",
dataType: "json",
cache: false,
success: function (data) {
alert(data);
if (data != '')
$('#checkboxContainerDiv').html(data);
},
error: function(msg) {
alert('error');
}
});
然后我只需要获取这些信息并在 ComponentEngineer.aspx 页面上进行转换。它不是网络服务。
谢谢!