开发者

jQuery Ajax Get not working

开发者 https://www.devze.com 2023-01-04 05:36 出处:网络
going to http://revyu.com/sparql?query=SELECT+%2A+WHERE+%7B%7D works totally fine by returning an XML file, but as soon as I use jQuery, I\'m getting errors:

going to http://revyu.com/sparql?query=SELECT+%2A+WHERE+%7B%7D works totally fine by returning an XML file, but as soon as I use jQuery, I'm getting errors:

var sparql="SELECT * WHERE {}";
var query = 'http://revyu.com/sparql?query=' + escape(sparql);

$.ajax( {
        dataType: "xml",
         url : qu开发者_Python百科ery,
         success : function(data) {
            alert(data);
        },
        error:function (xhr, ajaxOptions, thrownError){
                alert(xhr.status);
                alert(thrownError);
        } 
});

thrownError: TypeError: Cannot read property 'documentElement' of null.

Any idea why this is? Thanks a lot!


The problem may be the specified dataType. See the relevant jquery doc here. Try changing the dataType to "text".

0

精彩评论

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