Apologies for the unclear question, but here is my query...
I recently began using Ajax and encountered an issue with sending XMLHttpRequest in the background. I am facing problems with certain html special characters in the form data, especially the & sign which terminates the variable prematurely.
For example, a value like "You & I" gets transformed into "You" after submission.
To clarify, when submitting my regular form using the GET method, the same issue arises as the variables are URL-Encoded. However, switching to the POST method preserves everything as needed.
I suspect the problem lies in this code snippet:
hr.open("POST", link, true);
hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
Specifically, in the 'form-urlencoded' part. Is there an alternative solution to overcome this?
I would prefer not having to clean up each variable passed through Ajax individually. :(