Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2007
    Posts
    48
    Thanks
    4
    Thanked 1 Time in 1 Post

    "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.

  • #2
    New Coder
    Join Date
    Apr 2007
    Posts
    48
    Thanks
    4
    Thanked 1 Time in 1 Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •