Ajax post getting "cancelled"

we were making the ajax request from a link, and not preventing the link from being followed. So if you are doing this in an onclick attribute, make sure to return false; as well

 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);
    }
 });
 return false;
 }

Tags:

Ajax

Jquery