为什么如果我将 a 添加<br />
到“名称”属性中,ajax 不会发布到后面的代码中,但如果我不添加它,那么它可以正常工作?
下面的 JSON 数组是这样自动生成的:
// var tableOBJ = [];
//
//
// $("table tr").each(function () {
//
// var r = new rowOBJ(
// $(this).find('td').eq(0).val(),
// $(this).find('td').eq(1).text()
//
// );
//
// tableOBJ.push(r);
//
// });
var myJS =
[
{"name":"d <br />","surname":"cxzc"},
{"name":"d ","surname":"cxzc"},
{"name":"d ","surname":"cxzc"},
{"name":"d ","surname":"cxzc"},
{"name":"d ","surname":"cxzc"}
];
var gg = { "myText": JSON.stringify(myJS) };
//var gg = JSON.stringify({ "myText": myJS }); //this does not work either, code-behind does not see it at all
$.ajax({
type: "POST",
url: "send.aspx",
data: gg,
success: function (data) {
//pass
},
error: function () {
//fail
}
});
});
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim s As String = HttpContext.Current.Request.Form("myText")
End Sub