Skip to content Skip to sidebar Skip to footer

Send Special Characters With Ajax And Receive Them Correctly To Php

i've got a javascript function which get some datas on parameter and try to save them on a postgreSQL database. This is the javascript ajax function function insertCalendarEvents(c

Solution 1:

You need to pass the data through encodeURIComponent before adding it to the query string.


Also get rid of these lines:

request.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");

I'd be surprised if that was not always true.

request.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");

You aren't making a POST request. There is no message body to describe the content-type of.

Solution 2:

You should use encodeURI() on your parameters before sending them over via Ajax

Solution 3:

use POST it should safely deliver your datas plus is more logical to use to update stuff from client

Post a Comment for "Send Special Characters With Ajax And Receive Them Correctly To Php"