I have a website where I make an ajax call like this:
// perform an ajax request to generate a new subscriber account
jQuery.ajax({
Are you sure that the URL you're calling (/index.php?option=com_content&view=article&id=45&tmpl=component
) works in IE9? If you load that PHP page up in IE9, does it return the expected result? It should do, but it's worth checking that the error is in the jQuery call, rather than the PHP.
Also, a POST call would usually be to a page like 'index.php', with the query string (option=com_content
, view=article
etc.) sent as the variable postVars
.
Try using the following:
$.ajax({
type: "POST",
url: "index.php",
data: {
option : com_content,
view : article,
id : 45,
tmpl : component
},
success: function(msg){
console.log(msg);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(textStatus)
}
});
Strip down the function to its basic parts, and you should be able to see where the error is coming from.
Well I finally tracked down the problem. It turns out that for some reason jQuery/IE does not correctly urlencode double quotes. The URL of the request was:
/search.json?callback=jQuery16105234487927080267_1313510362362&q=stocks OR "stock market" -blueprint -empireavenue.com -learn&_=1313510362469
In every other browser by the time jQuery performed the ajax request it looked like:
/search.json?callback=jQuery16105234487927080267_1313510362362&q=stocks%20OR%20%22stock%20market%22%20-blueprint%20-empireavenue.com%20-learn&_=1313510362469
but for whatever reason in all versions of IE it came out like this:
/search.json?callback=jQuery16105234487927080267_1313510362362&q=stocks%20OR%20"stock%20market"%20-blueprint%20-empireavenue.com%20-learn&_=1313510362469
which caused the server to return no data.