When Adblock is active in chrome below script is not working in chrome. It shows error in console like this
jquery-1.7.2.min.js:4 GET http://example.com/advertisement/mult_select/30 net::ERR_BLOCKED_BY_CLIENT
jquery-1.7.2.min.js:4 POST http://example.com/advertisement/getCategoryFieldsList/30/0 net::ERR_BLOCKED_BY_CLIENT
I have tried also anti-adblock-killer.user.js. But still it is not working.
<script>
$(document).ready(function(event){
$('.category_1').live('change',function(){
var foo = [];
var name = [];
$('.category_1 :selected').each(function(i, selected){
foo[i] = $(selected).val();
name[i] = $(selected).attr("myTag");
});
//$('.category_title_0').html(name[0]);
var str = (foo[0]).replace(/\,/g, '');
$(this).parent('div').nextUntil('#tit').remove();
var str2 = $(this).find('option:selected').attr('parent_id');
$.ajax({
url: "<?= site_url('advertisement/mult_select')?>"+'/'+str,
success:function(result)
{
$('.mul-select').append(result);
}
});
$.ajax({
type: "POST",
dataType: 'script',
url: "<?= site_url('advertisement/getCategoryFieldsList') ?>"+"/"+str+"/"+str2,
success: function(result)
{
if($("#"+str2).length > 0)
{
$("#"+str2).empty();
$("#"+str2).nextAll('*').empty();
$("#"+str2).html( result );
}
else
{
$('#dynamic_fields_div').append( "<div id="+str2+"></div>" );
$("#"+str2).html( result );
}
}
});
});
});
As mentioned in the comments, the issue is that adblock recognizes the word advertisement in the URL and it thinks it's an ad.
Many applications work this way (for example it happened to me that Kaspersky blocked a page on a site i own because it contained the words toss and ban) so you should be careful about the URL you write to take into account that visitors might have applications that block certain bad words.
In my case i didn't have the name "advertisement" on the url path, but still got the same ERR_BLOCKED_BY_CLIENT error.
I resolved it by giving cache: false option to the $.ajax() function.
I am leaving this comment here, as it may be useful to someone.