Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ajax和jQuery在Firefox中工作,在Chrome中出现404错误_Jquery_Ajax_Google Chrome - Fatal编程技术网

Ajax和jQuery在Firefox中工作,在Chrome中出现404错误

Ajax和jQuery在Firefox中工作,在Chrome中出现404错误,jquery,ajax,google-chrome,Jquery,Ajax,Google Chrome,我有一个ajax请求: $.ajax({ dataType: 'json', error: function(result) { alert('Error: ' + result.status); }, type: 'GET', data: "", success: function(data) { //do some stuff }, url: 'info/' + hash + '.json' })

我有一个ajax请求:

$.ajax({
    dataType: 'json',
    error: function(result) {
        alert('Error: ' + result.status);
    },
    type: 'GET',
    data: "",
    success: function(data) {
        //do some stuff
    },
    url: 'info/' + hash + '.json'
});
虽然在Firefox中效果很好,但在Chrome中我遇到了一个404错误,我如何修复它使其在Chrome中也能工作?

尝试使用完整的url-

url: 'http://yoursite.com/YourDirectorys/info/' + hash + '.json
或非相对url-

url: '/YourDirectorys/info/' + hash + '.json

尝试在顶部指定url。如果不发送数据,也不要指定