Jump to content

escaping post data with ajax - eliminates backslash


calabiyau

Recommended Posts

I am building my own framework and have used "editarea" as my online code editor.  I use ajax to open and save files from the server.  everything is working properly, except one thing.  I discovered that in order to get the save to work I had to use the javascript escape() function before sending the post request to the server, otherwise the & symbols in the code messed up the post request.  Now the problem is if the code contains something like this:

 

$server_path = "C:\server\apache\www";

 

When it saves the file, it comes out like this:

 

$server_path = "C:serverapachewww";

 

I do a strip slashes on the php receiving end before saving the file to get rid of the escapes created by the javascript end, and through alerts discovered that that is not the problem.  They are being eliminated before the ajax request is sent.  Anybody have any ideas on how to resolve this problem?  Am I using the wrong approach?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.