Jump to content

AJAX responseText returns with "\r\n" at the front.


Recommended Posts




I am calling an update method in my javascript that sends an AJAX request to a PHP script. That compiles an array of values and is supposed to return a delimited string of name=value pairs like this:


name1210=Tom Burns;company1210=Technet Center;id1210=2229


The PHP is compiling an array and then joining it with the delimeter. I did a var_dump from PHP on the resulting string and it returns exactly what I was expecting. However, when I get the string back into my AJAX environment, it looks like this:


rn name1210=Tom Burns;company1210=Technet Center;id1210=2229


The carriage return line feed show up for who know why, and that makes the first name=value pair inaccessible, because I don't have an element named "rn name1210".


I tried a string.replace on the full "rn" and on portions of it, to no avail. Does anyone know how I can either avoid getting this in the first place or getting rid of it afterward?


Thank you.



Edited by taxidev
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...