Actually in my website have a WebMethod that return two values from MySQL database.
I'm calling that method throw AJAX but the problem is that when i'm trying to parse a specific data i get the following error: Unexpected token o in JSON at position 1
While here is the code
function getAjax(data) {
$.ajax({
type: "POST",
url: "stats.aspx/getSC",
data: JSON.stringify({ data: data }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
var data = $.parseJSON(result);
$('#sc-gg').text(data.TOTSC);
},
error: function (xhr) {
alert(xhr.status);
}
});
}
The WebMethod will ever return just two values from the database which i will set to a "statistic box"