I am posting some data to the server using JQuery.post(), as shown below. When I receive the post data on the server side, I am surprised to see that the post variables already have single apostrophes converted to html numbers (ie. ‘ is replaced with '). How is this happening? Does the conversion happen in Jquery.post()? I cannot find any documentation on this.
$("#save").click(function(event) {
event.preventDefault();
var postdata = "id="+id+"¬e="+$("#note").val();
$.post("save_note.php", postdata, function(data){
$('#save_status').text(data);
});
});
It’s happening in the web browser.
Check the value of
$("#note").val()– remember under the covers when you type something in a form field it’s being inserted into the HTML DOM.