I am sending an ajax request with two post values, the first is the "action" that determines what actions my PHP script should process, the other is the "id", which is the identifier of the user to whom the script should parse.
The server returns 6 values inside the array () and then is encoded in JSON using the PHP function: json_encode();
Some of my answers are HTML, but when I encode it in JSON, it eludes "/", so it becomes "\/"
how can I disable this?
also, when I don’t know how to display this in jQuery, when I get the server response, I just thought that all this in the div would just display the numbers and HTML codes that I requested, but it displays an array since it is encoded in PHP .
Php
$response = array();
$response[] = "<a href=''>link</a>";
$response[] = 1;
echo json_encode($response);
JQuery
$.ajax({
type: "POST",
dataType: "json",
url: "main.php",
data: "action=loadall&id=" + id,
complete: function(data) {
$('#main').html(data.responseText);
}
});
How to do it for JSON to work?