开发者

having trouble getting malformed JSON cross-domain

开发者 https://www.devze.com 2023-01-22 17:13 出处:网络
This is a very narrow scope of the code, but it is where the issue lies. function getJSON(tabUrl){ $.getJSON(tabUrl, function(data){

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 loca开发者_运维知识库l 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 list shows that we are to make a text request and use eval() to evaluate the contents.

0

精彩评论

暂无评论...
验证码 换一张
取 消