Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
ajax, entities, quotes and IE
Old 07-16-2008, 08:20 AM ajax, entities, quotes and IE
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
hi

im trying to send strings containing double and single quoted around my site using AJAX post requests and JSON. Is there a neat and tidy/ or even possible way of doing this in IE? I have a messy system working in firefox.

The problem seems to be in the enitity encoding being lost during the post, if i alert my post data pre posting, my ajax string looks like
{"name":"m%27%22ark%27s%20band"} . If i echo it as soon as it reaches my form handling page (pre ajax decode) it looks like {"name":"m'"ark's band"} and the process of decoding is messed up because of the quotes.

is it something to do with the urlencoding of the posted data?

if anyone knows of a tutorial covering this, a different system i can use, or has overcome a similar issue in the past, please point me in the right direction, i am losing my will to live.

mark m
hiptobesquare is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-16-2008, 10:16 PM Re: ajax, entities, quotes and IE
Extreme Talker

Posts: 238
Location: United States
Trades: 0
You need to escape any double quotes inside a JSON value with a backslash (i.e., \"). So {"name":"m'"ark's band"} should be {"name":"m'\"ark's band"}.

I personally use this public domain script to parse and stringify all my JSON in JavaScript. It takes care of proper syntax and double quote escaping.
__________________
The interlocking pieces of web development: usability, performance, accessibility, and standards.
frost is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to ajax, entities, quotes and IE
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09581 seconds with 12 queries