Reputation: 314
Ran into an issue that has stumped me for 2 days now. I use codeigniter for my backend and jquery for my front end. Almost all my controller functions are loaded via jquery $.ajax without any issues, until yesterday.
For some random reason whenever I perform an ajax query on my controller named "advertising", it fails, yet if I literally copy/paste the same ajax query and only change the url to another controller, it works fine. The issue is only occuring in chrome, and the same query works fine in firefox and ie.
Here is the code:
$("a").on("click", function(a){
a.preventDefault();
var path = $(this).attr("href");
$.ajax({
Type: "get",
dataType: "html",
url: path,
success:function(result){
$(".contentgrid").hide().html(result).fadeIn("fast");
}
})
})
This throws the following error in chrome:
send jquery.min.js:2
v.extend.ajax jquery.min.js:2
(anonymous function) main.js:743
v.event.dispatch jquery.min.js:2
o.handle.u
Yet if I paste the ajax request above and manually type some other controller/function name, it works correctly. If manually type the controller named "advertising" it fails. Again, this works perfectly fine in both IE and Firefox. I'm totally lost. Thanks for anyone who can give me a hand.
Upvotes: 0
Views: 2403
Reputation: 36
Sorry I didn't post the fix. The reason this wasn't working was because the "AdBlocker" extension blocks anything with "advertising" in ajax.
Upvotes: 1
Reputation: 771
My guess is that the HTML isn't perfectly valid - try using .text()
instead of .html()
to check out what happens, and if it works, fix the invalid HTML.
Upvotes: 0