简体   繁体   中英

having trouble getting malformed JSON cross-domain

This is a very narrow scope of the code, but it is where the issue lies.

function getJSON(tabUrl){
  $.getJSON(tabUrl, function(data){
    console.log(data);
  });
}

I am using jquery 1.3 because getJSON in 1.3 can handle malformed JSON. The server I'm getting my json from uses the old parameter:'value' format.

Here is the perplexing issue.

If tabUrl is a cross-domain server and is valid JSON, it works fine.
If tabUrl is a local file and is either valid OR INVALID it works fine.
If tabUrl is a cross-domain and is invalid I get no errors in firebug but cannot manipulate the data.

I have no problem using jQuery 1.4 if there is a workaround someone can propose.

You could try Yahoo Pipes for this. I think it can fix your JSON and also return a JSONP for using cross-domain.

jQuery 4.0 Breaking Changes列表显示我们要发出文本请求并使用eval()评估内容。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM