Cokegod
Cokegod

Reputation: 8424

Ajax with jQuery works in Firefox and gets 404 error in Chrome

I have this ajax request:

$.ajax({
    dataType: 'json',
    error: function(result) {
        alert('Error: ' + result.status);
    },
    type: 'GET',
    data: "",
    success: function(data) {
        //do some stuff
    },
    url: 'info/' + hash + '.json'
});

And while in Firefox this works great, in Chrome I get a 404 error, how can I fix it to work in Chrome too?

Upvotes: 0

Views: 1061

Answers (1)

kleinohad
kleinohad

Reputation: 5912

try to use a full url-

url: 'http://yoursite.com/YourDirectorys/info/' + hash + '.json

or a none relative url-

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

Upvotes: 1

Related Questions