The aim of this gist is to show how to handle the execution of simple SPARQL query over the DBpedia SPARQL endpoint using Javascript, JQuery and AJAX.
xxxxxxxxxx
<html>
<head>
<meta name="description" content="Seminario CNR MI - Example 1" />
<meta charset="utf-8">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript" src="index.js"></script>
<title>Seminario Linked Data</title>
</head>
<body>
<h1>EXAMPLE N° 1</h1>
<div><b>SPARQL QUERY:</b></div>
<div id="query" contentEditable="true">
<pre>
<code>
PREFIX : <https://dbpedia.org/resource/>
PREFIX dbp: <https://dbpedia.org/ontology/>
SELECT ?x
WHERE {
:Pisa dbp:country ?x.
}
</code>
</pre>
</div>
<div>
<input type="button" onclick="retrieveData()" value="Execute Query">
</div>
<br>
<div><b>RESULTS:</b></div><br>
<div id="output_div">
</div>
</body>
</html>
https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js