JSON Feed Returning null while using jQuery getJSON

非 Y 不嫁゛ 提交于 2019-12-05 16:39:59

The JSON is not valid apparently. Cut and paste it into http://www.jsonlint.com/ for more details on the syntax error. The JSON parser you are using is failing, perhaps another one will be more lenient.

ethyreal

I think the ( ) around your JSON output are what is causing the null return. I would check the json.cfm output and remove the ( )'s

Update:

The ( ) are supposed to border a remote call using jsonp.

I just ran a local test of the output in a local file and it works.

Using both:

$.getJSON("http://portlandonline.com/shared/cfm/json.cfm?c=27321", function(data){
   alert( data );
  });

and :

$.ajax({
    dataType: "jsonp", 
    url: 'http://portlandonline.com/shared/cfm/json.cfm?c=27321',
    success: function(data) {
     ...do stuff
    }   
   });

Should properly avoid any cross domain scripting issues.

i get a clean response in firebug for both these requests. the key is sending the datatype "jsonp"

More info on jsonp.

See if these help you also:

Make cross-domain Ajax requests with jQuery

Dashboard Cross-domain AJAX with jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!