Reputation: 23
I had a JSON url for news.
http://www.alcaldiamunicipiosucre.gob.ve/contenido/api/appmob/noticias/?dev=1
I'm trying to retrieve this info with this:
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$.getJSON("http://www.alcaldiamunicipiosucre.gob.ve/contenido/api/appmob/agenda/?dev=1",function(result){
$.each(result, function(i, field){
$("div").append(field + " ");
});
});
});
});
</script>
</head>
<body>
<button>Get JSON data</button>
<div></div>
</body>
</html>
Please help, this example works with this page:
Mention me what wrong i did. I can't get the info from the json.
Thank you very much in advance.
Upvotes: 0
Views: 115
Reputation: 1722
It looks like that domain doesn't allow cross domain requests. The domain needs to return
Access-Control-Allow-Origin: *
or equivalent.
Upvotes: 1