开发者

disable entities in jquery/ajax

开发者 https://www.devze.com 2023-03-11 19:41 出处:网络
I need to disable entities in ajax/jquery... is there any way to do this? example when a user inputs a link, once it is process by the script alot of characters are replaced.

I need to disable entities in ajax/jquery... is there any way to do this?

example when a user inputs a link, once it is process by the script alot of characters are replaced. I will paste that part of the link after the .com/ here.

onthefarm/track.php?creative&cat=feed&subcat=mystery_seeds_complete&key=6f8d7bfafa5b157aa29c0e3920630cad%24%24idG%21N-OS1YyMY4M9yNJE.1bz%2AYXsMyRHY5Byhuf开发者_如何学运维6vqhE3eFtP48kKVdp7C%2AVbI4NJ&next=reward.php%3FfrHost%3D711208004%26frId%3D9jzg1otryxc8skg4gkko8kgs8%26frType%3DConstructionBuildingFriendReward%26key%3D6f8d7bfafa5b157aa29c0e3920630cad%24%24idG%21N-OS1YyMY4M9yNJE.1bz%2AYXsMyRHY5Byhuf6vqhE3eFtP48kKVdp7C%2AVbI4NJ&ref=nf

I have successfully "kept the & sign" by using %26 before sending it to ajax/jquery. If you take the time to look at this link you will see there are alot of %24, $21, among other things that will be replaced so my temporary solution was to add this code after...

   $text = str_replace("%26", "&", $text);
   $text = str_replace("*", "%2A", $text);
   $text = str_replace("(", "%28", $text);
   $text = str_replace(",", "%2C", $text);
   $text = str_replace("$", "%24", $text);
   $text = str_replace("reward.php?", "reward.php%3F", $text);
   $text = str_replace("frHost=", "frHost%3D", $text);
   $text = str_replace("&frId=", "%26frId%3D", $text);
   $text = str_replace("&frType=", "%26frType%3D", $text);
   $text = str_replace("FriendReward&key=", "FriendReward%26key%3D", $text);

I had to do it this way so that it is done one at a time, as you see in the url there are insances of "&key" and "%26key" one is supposed to be "%26key" and one is supposed to "&key". If I can just tell the script to not urlencode.

It is not a database issue, I put the information in with a standard form that doesn't use jquery/ajax and the information is stored in the database exactly as the user put it in.


It sounds like you need to URL encode your text. The "&" symbol would be %26, see here: http://www.w3schools.com/tags/ref_urlencode.asp


& has a special meaning in URLs, separating parameters. it may need to be escaped before being sent into urlencode, or that is why it is being separated there. idk just a theory

0

精彩评论

暂无评论...
验证码 换一张
取 消