Ajax - Ampersand problem

0 Franz Schmidt · July 5, 2015
Got a little problem here where I need your help pls:

I've got a textarea where I can input any data I want, which gets saved in a database via mysqli. And whenever I try to save data with an ampersand (&) I get the Error:

Type Error: Cannot read proberty 'documentElement' of null.

I get this data via ajax method. But it seems that the tag where the ampersand should be is empty so the javascript code crashes.
I estimate that the problem could be solved if the ampersand gets decoded somehow befor saving and encoded after the xml response.

Post a Reply

Replies

Oldest  Newest  Rating
0 Franz Schmidt · July 6, 2015
Thanks that worked but I found out when I somewhere in my input I would enter also "%26" I would replace it at the output with an ampersand sign how can I avoid that?
  • 1

Javascript

107,288 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators