Here is a function that retrieves details:
function GetSomeDetails(Param)
{
Json_Parameters = JSON.stringify(Param);
$.ajax({
type: "POST",
url: "MainPage.aspx/MyMethod",
data: JSON.stringify({ "Param": Json_Parameters }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result)
{
var json = result.d;
obj = JSON.parse(json);
if (JSON.stringify(obj) == '{}'){
alert('it is empty');
} else{
alert('it is not empty'); }
}
});
}
An error message is displayed if the data is empty:
SyntaxError: JSON.parse: unexpected character JSON data