0

I am trying to get the console.log to work with the 'interests' information using the following JSON request but I get the following error message in the console.

XMLHttpRequest cannot load https://app.citizenspace.com/api/2.3/json_consultation_details?dept=parliament&id=ddcengage&fields=all. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$.getJSON ('https://app.citizenspace.com/api/2.3/json_consultation_details?dept=parliament&id=ddcengage&fields=all'), function(data) {
consol.log(data.interests)
}
</script>

Can anyone help with this?

Brad
  • 159,648
  • 54
  • 349
  • 530
Dave Kane
  • 69
  • 2
  • 8

2 Answers2

0

You should use JSONP (http://learn.jquery.com/ajax/working-with-jsonp/), you won't get console.log working until you fixed the cross origin error

more info: What is JSONP all about?

Community
  • 1
  • 1
0

there is an issue with your parantheses

 $.getJSON ('https://app.citizenspace.com/api/2.3/json_consultation_details?dept=parliament&id=ddcengage&fields=all', function(data) {
      console.log(data.interests)
 });
Hinrich
  • 13,485
  • 7
  • 43
  • 66