我正在发布跨域的个人资料结果,浏览器正在帖子中编码@符号,导致处理功能崩溃。我无法访问服务器端处理脚本来解码值和@符号。
我的问题:有没有办法强制浏览器不对post参数中的@符号进行编码?或者有什么方法可以对处理脚本可以接受的方式进行不同的编码。
Post Prams: USEREMAIL =名称%40domain.com&安培;办公电话= 1-800-000-000&安培; MobilePhone = 000-000-000&安培; HOMEPHONE = 000-000-0000&安培; EmailAddress的名称=%40domain.com&安培; ClientNumber = 00000&安培;邮编= 00000&安培; StreetAddress = 000 + steet& City =某个城市&州; = Colorado& FirstName =测试+版本+ 61& LastName = name& Clientcomments = this +是+ a + description + in + sa + should + map + to + the
jQuery AJAX:
$.post(
"https://secure.domain.com/Import.aspx?Provider=1&Client=2&CampaignId=1032&DirectTransfer=true",
{ UserEmail: 'name@domain.com', WorkPhone: data.WorkPhone, MobilePhone:
data.CellPhone, HomePhone: data.MainPhone, EmailAddress: 'name@domain.com',
ClientNumber: data.ClientNumber, Zip: data.MainZipCode, StreetAddress:
data.MainStreetAddress, City:
data.MainCity, State: data.MainState, FirstName: data.FirstName, LastName:
data.LastName, Clientcomments: data.Discription
},
function(rdata) {
console.log(rdata)
},
'script');
答案 0 :(得分:0)
$ .post实际上是$ .ajax的快捷方式,所以请改用$ .ajax并将content-type指定为application / json。
$.ajax({
url: 'https://whatever.com',
contentType: 'application/json',
dataType: 'json',
data: '{"name": "value"}',
type: 'POST',
success: function(data, textStatus, jqXHR){
},
error: function(XMLHttpRequest, textStatus, errorThrown){
}
});
});