Jquery 发送前的Ajax编码参数?
我接到这个电话Jquery 发送前的Ajax编码参数?,jquery,json,ajax,encodeuricomponent,Jquery,Json,Ajax,Encodeuricomponent,我接到这个电话 $.cordys.ajax({ url : "xxx" method: "xxx", namespace: "xxx", parameters: { Lines : { "@xmlns" : "http://www.exemple.com", Line : TFLines } },
$.cordys.ajax({
url : "xxx"
method: "xxx",
namespace: "xxx",
parameters: {
Lines : {
"@xmlns" : "http://www.exemple.com",
Line : TFLines
}
},
success: function(data) {
console.log(data);
}
}).fail(function(error) {
alert(error);
});
我想发送一个对象行,它是行的集合,对象TFLine是一个数组,如下所示:
[{
@xmlns: "http://exemple.com",
Code: "DENOLEGAL",
Comments: "",
Content: "<![CDATA[<strong>test</strong>]]>",
DisplayedLanguageId: "1",
DisplayedLanguageName: "FR",
IsMandatory: "1",
Label: "Dénomination légale de vente"
}, {...}
]
我认为ajax库做到了这一点,实际上没有,我在库使用encodeURIComponent()的任何地方都放置了断点,有人停止了
你知道为什么会发生这种情况吗?负载是HTML编码的(不是URL编码的)。因此,您可以发现代码的某些部分是否是对有效负载数据进行Html编码的 有效载荷应编码为
%3C!%5BCDATA%5B%3Cstrong%5Btest%3C%2Fstrong%5B%5D%5D%5B
%3C!%5BCDATA%5B%3Cstrong%5Btest%3C%2Fstrong%5B%5D%5D%5B