I am using the following script to my php script on my server;
$.ajax({
type: 'POST',
url: 'http://xx.php',
data: { anyNumber: val1 },
success: function(data) {
alert(data);
}
});
the php script correct queries sqlsrv database and returns row of data that I encode with
echo json_encode($rows);
I then correctly receive the json string into data (as above example)
When I display the data with alert(data);
as above, I get the following:
"({\"id\":1,\"Username\":null,\"Category\":null,\"VIN\":null,\"Make\":null,\"Model\":null,\"Colour\":null,\"Registration\":\"12345 \",\"RegisterNumber\":null,\"EngineNo\":null,\"Branding\":null,\"Remarks\":null,\"Photo1\":null})"
I have tried various methods but cannot assign the various elements to variables. Please help