I want to get the Abtract of english article of civil engineering from Dbdepdia in Javascript. this is what I tried but it fail.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<style type="text/css">
</style>
</head>
<script type="text/javascript">
var url = "http://dbpedia.org/sparql";
var query = "\
PREFIX dbpedia2: <http://dbpedia.org/resource/>\
PREFIX Abs: <http://dbpedia.org/ontology/>\
SELECT ?abstract\
WHERE {\
?s dbpedia2:Civil_engineeringe\"@en;\ Abs:abstract ?abstract\
}";
this how I encode the url to pass it to ajaxx
var queryUrl = encodeURI( url+"?query="+query+"&format=json" );
$.ajax({
dataType: "jsonp",
url: queryUrl,
success: function( _data ) {
var results = _data.results.bindings;
for ( var i in results ) {
var res = results[i].abstract.value;
alert(res);
}
}
});
</script>
<body></body>
</html>