Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery AJAX problem in IE7 (possibly other versions as well)

Can anyone enlighten me as to why the following code won't work in IE7 but it works just fine in Chrome/Firefox?

$(document).ready(function(){
  $.ajax({
    type: "POST",
    dataType: "text",
    cache: false,
    url: "/ajax/ajax.asp",
    data: "cmd=check_forfeits",
    success: function(msg) {
      return false;
    }
  });
});

The javascript error IE throws out is 'Permission Denied'

If I remove that bit of code from the JS file for the page in question the page works just fine, no errors, so the error lies in that bit of code I believe.

:::UPDATE:::

Something else that is a little strange is that when I refresh the page (in IE7) I get no javascript errors and this code seems to work correctly. So it's as if the first time the page loads this code snippet errors but after that it runs just fine.

:::UPDATE:::

Here are the fiddler posts for this page from IE7:

#   Result   Protocol   Host                 URL
1   200      HTTP       192.168.47.13:8000   /
2   304      HTTP       192.168.47.13:8000   /js/jquery-1.4.1.js
3   200      HTTP       192.168.47.13:8000   /js/index.js
4   304      HTTP       192.168.47.13:8000   /js/jquery-1.4.1.js
5   200      HTTP       192.168.47.13:8000   /js/index.js
6   304      HTTP       192.168.47.13:8000   /css/main.css
7   304      HTTP       192.168.47.13:8000   /css/grid.css
8   304      HTTP       192.168.47.13:8000   /images/banner.jpg

Here are the fiddler posts for this page from Firefox:

#   Result   Protocol   Host                 URL
1   200      HTTP       192.168.47.13:8000   /
2   304      HTTP       192.168.47.13:8000   /js/jquery-1.4.1.js
3   304      HTTP       192.168.47.13:8000   /js/index.js
4   304      HTTP       192.168.47.13:8000   /css/grid.css
5   304      HTTP       192.168.47.13:8000   /css/main.css
6   304      HTTP       192.168.47.13:8000   /images/banner.jpg
7   200      HTTP       192.168.47.13:8000   /ajax/ajax.asp
like image 383
Ryan Avatar asked Feb 23 '10 14:02

Ryan


People also ask

What is the JavaScript disabled browsers problem?

This problem occurs when a designer has incorporated JavaScript and Ajax enhancements into their website’s architecture without making provisions for browsers that have disabled JavaScript.

Is it possible to use JavaScript with AJAX-driven enhancement?

Although the content is fully accessible with JavaScript disabled, most users will see the enhanced Ajax-driven version. The principle of progressive enhancement for Ajax is well known, because it is commonly used for unobtrusive JavaScript techniques and is inherent in CSS, as illustrated by the graphic below:

How can I indicate that content has been updated using Ajax?

A similar graphic or indicator could be used at the end of an Ajax request to tell users that content has been updated. This would be implemented in addition to, not instead of, the progress indicator proposed for the previous problem. A similar but subtler way to indicate that an area of content has been updated is the yellow fade technique.

What is Ajax and how does it work?

Although the details of this solution are far beyond the scope of this article, we’ll go over the basic principle at work. Because an Ajax request originates in the client’s browser, it must reference a file at another location but on the same domain as the source of the request.


1 Answers

if people happen to find this page because they're experiencing the same error - I just found another cause / solution for IE7 failing with this "PERMISSION DENIED" error and succeeding on a refresh.

Make sure that if you're using this in your <head> tag:

<meta http-equiv="content-type" content="text/html;charset=utf-8" />

Note that it does not have any capital letters or a space after the ";". Our site had this version:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

and that caused the same behavior when making AJAX calls.

Hopefully this helps someone else, because we just spent about 6 hours figuring this out.

like image 84
Jason Avatar answered Sep 22 '22 10:09

Jason