[jQuery] Return False does not work in some conditions
<div dir="ltr">Hello,
I got noob question.
Following code used in one of my projects.
Ajax and other sliding things was working well.
The Problem is
Recently I use zebra colors. And now when I do ajax request, response shown in opposite color.
to fix issue I add some even odd checker and it does not work as expected. Later I found fix must be work after some time. so I put the
jQuery.sleep(1000);
after adding this line following return false does not work..
Is there any advice ?
Thanks
$('div.cResponseHotelVerifyCover').hide();
$('.cResponseHotelPriceCheck').click(function() {
var myId = <a href="http://this.id">this.id</a>;
var idInd = myId.replace('priceCheckId-','');
var targetId = '#responseHotelPrice-'+idInd;
var sRequest = this.href+'&av=true';
var sHtmlVal = this.innerHTML;
$(this).parent().next().next().slideToggle('fast');
$(this).parent().next().next().html('<img src="<?=$this->plugin['loading_picture'];?>" alt="loading" title"loading" /> <?=evo::$lang[$this->lang]['_please_wait_your_request_verified_'];?>');
$(this).parent().next().next().load(sRequest);
if($(this).parent().next().next().attr('class').split(' ').slice(-1) == 'cOdd') {
$('div.cResponseAjaxTrue').addClass('cOdd');
} else {
$('div.cResponseAjaxTrue').addClass('cEven');
}
$(targetId).html(sHtmlVal);
return false;
});
$('div.cResponseHotelDetailCover:odd').addClass('cOdd');
$('div.cResponseHotelVerifyCover:odd').addClass('cOdd');
</div>