I have an ajax post, but it's getting cancelled. I just made a test.php
file which is just supposed to echo 'test';
value.
This is how my ajax script looks like:
function loadAd(date) {
var ajax_url = '<?=URL?>components/ajax/grab_ads.php';
$.ajax({
type: 'POST',
url: ajax_url,
dataType: 'html',
data: ({
date : date
}),
cache: false,
success: function(data) {
if(data > 0) {
$('.advert').fadeIn("fast");
}
},
error: function(xhr, textStatus, errorThrown) {
//alert('Nastala chyba. ' + errorThrown);
}
});
}
The function is called, I tried console logging it. The variable is passed okay as well. This is what I'm getting in chrome network tab. screenshot
Other than that I am quite helpless.
Edit: I call the function like this:
$datum = Date("d-m-Y H:i:s");
$adl .= '<script type="text/javascript">
loadAd(\''.$datum.'\');
</script>';