Loading cross-domain endpoint with AJAX

前端 未结 9 1661
醉酒成梦
醉酒成梦 2020-11-21 05:20

I\'m trying to load a cross-domain HTML page using AJAX but unless the dataType is \"jsonp\" I can\'t get a response. However using jsonp the browser is expecting a script m

9条回答
  •  囚心锁ツ
    2020-11-21 05:54

    Your URL doesn't work these days, but your code can be updated with this working solution:

    var url = "http://saskatchewan.univ-ubs.fr:8080/SASStoredProcess/do?_username=DARTIES3-2012&_password=P@ssw0rd&_program=%2FUtilisateurs%2FDARTIES3-2012%2FMon+dossier%2Fanalyse_dc&annee=2012&ind=V&_action=execute";
    
    url = 'https://google.com'; // TEST URL
    
    $.get("https://images"+~~(Math.random()*33)+"-focus-opensocial.googleusercontent.com/gadgets/proxy?container=none&url=" + encodeURI(url), function(data) {
        $('div.ajax-field').html(data);
    });

提交回复
热议问题