如何防止jquery ajax对数据参数编码某些字符? [英] how do I prevent jquery ajax to encode certain chars on data parameter?

查看:176
本文介绍了如何防止jquery ajax对数据参数编码某些字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jquery ajax从三方Web服务中查询数据 问题是我需要将冒号char :作为数据的一部分传递,而不对其进行编码,但是$ .ajax方法会自动对所有非字母字符进行编码.所以问题是
如何防止jquery ajax对数据参数上的某些字符进行编码?
更新
我知道冒号是经过编码的,因为我可以在Firebug中看到它
更新
如果我在浏览器的URL框中使用它,则会得到所需的数据
http://example.com?callback=jsonp1316104718105&quit=20100299222.0& ; show = name:fransisco
如果我在浏览器的URL框中使用它,则会得到错误的数据
http://example.com?callback=jsonp1316104718105&quit=20100299222.0& ; show = name%3Afransisco
问题是$ .ajax正在编译最后一个

i am using jquery ajax to query data from a three party web service the problem is that I need to pass the colon char : as part of the data, without encoding it but $.ajax method is automaticaly encoding all non alphabetic chars. so the question is
how do I prevent jquery ajax to encode certain chars on data parameter?
update
I know that the colon is encoded because I see it with Firebug
update
if i use this on the browser url box I get my desired data
http://example.com?callback=jsonp1316104718105&quit=20100299222.0&show=name:fransisco
if i use this on the browser url box I get wrong data
http://example.com?callback=jsonp1316104718105&quit=20100299222.0&show=name%3Afransisco
the problem is that $.ajax is compiling the last one

推荐答案

您可以使用字符串:

$.ajax({
   data: "colons=::::::::",
   processData: false,
   ....
});

这篇关于如何防止jquery ajax对数据参数编码某些字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆