I use jQuery to send data from the client to the server and to store data in my database. Now I use the $.post-function from jQuery. I use it like the following
var queryUpd = "UPDATE settings SET round_duration='10'"
$.post("../../server/test.php", {func: "manipulate", query: queryUpd}, function(json, textStatus)
{
alert(json); //Outputs UPDATE settings SET round_duration =\\\'10\\\'
});
The php funcion "test.php" is simple:
<?php
echo json_encode($_POST["query"]); //send values to the client
?>
As you can see, the php-function gets an invalid query, since it adds two backslashes in front of the \'. So why does this happen and how can I solve this problem?