I have displayed the result of a SPARQL query in a HTML page using Json, my question is when a certain value is entered and the query does not display a result it should dis
You can do this several different ways:
If bindings
is a constant of your object, but may sometimes be empty:
if (data.results.bindings.length) {
//exists
} else {
alert('goes here');
}
If bindings
is not always set in the response from the server:
if (data.results.hasOwnProperty('bindings')) {
//exists
} else {
alert('goes here');
}