Reputation: 969
I have a jQuery AJAX request that does not seem to be doing anything.
I see no action on the Network tab on Chrome Debugger,
The error/success callbacks are not being called inside the function and nothing seem to happen on the server side whatsoever.
The thing is, this is not happening on my main local domain: http://dev.sitename.com
It only happen on my inner pages, for example: http://dev.sitename.com/about
My guess is there is some .htaccess rule that is damaging the process but I see no Network activity what so ever, so how could it be?
Here's my code:
$.ajax({
url: 'ajax.php?cachekiller=' + (new Date()).getTime(),
data: {
action: 'doLogin'
},
success: function() {
// Not being called
},
error: function() {
// Not being called either
}
});
Thank you
Upvotes: 0
Views: 1452
Reputation: 31033
OK every thing seems to be fine, here are a few things that you can check out
/
before the url
like and make sure that you have placed the ajax.php
at the root of your server$.ajax({ url: '/ajax.php', cache:false, data: { action: 'doLogin' }, success: function() { // Not being called }, error: function() { // Not being called either } });
you dont need to use cachekiller use cache:false
prop of ajax method
Upvotes: 1
Reputation: 51
try this:
$.ajax({
url: 'ajax.php',
cache: false,
data: {
action: 'doLogin'
},
success: function(data) {
console.log(data);
},
error: function() {
console.log('error');
}
});
and in ajax.php script:
header("Pragma: no-cache");
header("Cache-Control: must-revalidate");
header("Cache-Control: no-cache");
header("Cache-Control: no-store");
header("Expires: 0");
Upvotes: 4
Reputation: 824
try putting cachekiller on data param
$.ajax({
url: 'ajax.php',
data: {
cachekiller: (new Date()).getTime(),
action: 'doLogin'
},
success: function() {
// Not being called
},
error: function() {
// Not being called either
}
});
Upvotes: 2