Cross domain ajax request to a json file using JSONP

后端 未结 2 1367
庸人自扰
庸人自扰 2020-12-06 03:39

I want to access a JSON file which is in domain1 (example.com) from domain2 (example2.com). For example,

$.ajax({
    type:\'get\',
    url: \'http://example         


        
2条回答
  •  执笔经年
    2020-12-06 04:24

    Have you tried calling it as:

    $.getJSON('http://example.com/vigneshmoha.json?callback=foo', null, function(data) {
              console.log(data);
    });
    

    And see what happens?

提交回复
热议问题