Harold29
Harold29

Reputation: 23

Jquery $.getJSON not working to retrieve info

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:

http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?

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

Answers (1)

Dragony
Dragony

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

Related Questions