Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-04-2010, 04:13 PM   PM User | #1
broncozr
New Coder

 
Join Date: Apr 2007
Posts: 48
Thanks: 4
Thanked 1 Time in 1 Post
broncozr is an unknown quantity at this point
"Unescaping" data sent by AJAX to then use w/ PHP

I'm sending data that I JavaScript "escape()" from one page to another using an AJAX XMLHttpRequest. When it gets to the other PHP page, I would like to JavaScript "unescape()" that data. On the 2nd PHP page, I'm basically writing out an XML page (using PHP), from which I get several variables to return to the first page.

My question is how do I JavaScript "unescape()" the variables on the 2nd page so that I can use them in PHP. PHP is doing all of the work on the variables on the 2nd page. So, I'm basically trying to get my hands on a JavaScript-unescaped() version of the PHP $_REQUEST variables.

Any suggestions?

Thanks.
broncozr is offline   Reply With Quote
Old 06-04-2010, 07:12 PM   PM User | #2
broncozr
New Coder

 
Join Date: Apr 2007
Posts: 48
Thanks: 4
Thanked 1 Time in 1 Post
broncozr is an unknown quantity at this point
The data that I'm sending is usually text with some funky (e.g. Microsoft quotes) characters mixed in.

e.g. sending this with an AJAX request
Code:
‘some text’ `
gives me this on the 2nd PHP page that manipulates the data and stores it (I just store the data in a .txt file as a backup):
Code:
%u2018some%20text%u2019%20%60

1. Do I even need to escape it when sending the request?
2. How can I get the escaped data back to this on the PHP page that receives the request:
Code:
‘some text’ `

I guess my questions go to the larger question of what good practice is when sending/receiving AJAX requests with respect to escaping/unescaping.....

Hope that's clearer. Thanks.
broncozr is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 05:30 PM.


Advertisement
Log in to turn off these ads.