This service returns valid JSON data
var gridValsstr;
$.ajax({
type: "GET",
url: "InsertMessage",
cache: false,
success: function(data)
{
// alert(data);
gridValsstr = data;
},
error: function(xhr, status, error) {
alert(xhr.responseText);
}
});
However on this line:
var gridvals = JSON.parse(gridValsstr);
I get the error:
SyntaxError: JSON.parse: unexpected character
Which then causes the rest of my script to fail...
However if I put a break point at that line and wait for a few seconds the line processes correctly and loads the JSON into the UI. So I'm thinking it is processing too quickly or the variable isn't completely ready yet or something?