By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,483 Members | 1,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,483 IT Pros & Developers. It's quick & easy.

Synchronous Ajax Call in Mozilla.

dmjpro
100+
P: 2,476
Expand|Select|Wrap|Line Numbers
  1. function synchronous_ajax(){
  2.     var ajax = null;
  3.     if(typeof ActiveXObject!='undefined') ajax = new ActiveXObject("Microsoft.XMLHTTP");
  4.     else if(typeof XMLHttpRequest!='undefined') ajax = new XMLHttpRequest();
  5.     else{alert('Ajax is not support!!!!!');return;}
  6.  
  7.     alert('Yahoo: ' + ajax);
  8.     ajax.open("GET","http://www.google.co.in/",false);
  9.     ajax.send(null);
  10.     alert(ajax.status);
  11. }
It's working fine in IE 6 but whenever i am trying to run it in Mozilla then it shows me that ajax.open permission denied.
Could you please help me to figure out why it's happening?

Debasis Jana
Jul 11 '08 #1
Share this Question
Share on Google+
10 Replies


acoder
Expert Mod 15k+
P: 16,027
Permission is denied because it's from a different domain.
Jul 11 '08 #2

dmjpro
100+
P: 2,476
Permission is denied because it's from a different domain.
Then how it's is possible with IE.
I think IE does not check this.

Debasis Jana
Jul 12 '08 #3

acoder
Expert Mod 15k+
P: 16,027
Perhaps you're testing locally in IE?
Jul 12 '08 #4

dmjpro
100+
P: 2,476
Perhaps you're testing locally in IE?
Locally Test means?

I am simply wrote a HTML file having script and that Ajax call is being called on an event. I am not getting you how you meant Locally Test? :-)
Jul 14 '08 #5

rnd me
Expert 100+
P: 427
local = running from eg; c:\docs\mypage.htm in IE6.


its a fluke that it works. micro$oft has changed thier minds (to agree with everyone else that this is bad), and done everything they can to make sure it doesn't happen anymore.

something like a service pack can/will/should kill it at anytime.

enjoy it while it lasts, it wont happen again.
Jul 14 '08 #6

dmjpro
100+
P: 2,476
Perhaps you're testing locally in IE?
So Ajax call can't be done to different Domain.
Jul 15 '08 #7

acoder
Expert Mod 15k+
P: 16,027
Well, you can make a cross-domain request, but either you need to use a web proxy, or you use JSON, or dynamic script tags. There are other ways too. Firefox allows cross-domain requests with privileges.
Jul 15 '08 #8

dmjpro
100+
P: 2,476
Well, you can make a cross-domain request, but either you need to use a web proxy, or you use JSON, or dynamic script tags. There are other ways too. Firefox allows cross-domain requests with privileges.
How to use proxy in Code?
Or should i be using it somewhere else?
One more thing Acoder, what is JSON?
Cud u clarify me a bit? :-)

Debasis Jana
Jul 15 '08 #9

acoder
Expert Mod 15k+
P: 16,027
This link should help. Basically, you have a proxy on your web server which passes the request and receives the response from the other server and passes it back to your script. As for JSON, search for it. It's an alternative to XML.
Jul 15 '08 #10

gits
Expert Mod 5K+
P: 5,343
or follow this link to the json-homepage :) to get more information about it ...

kind regards
Jul 15 '08 #11

Post your reply

Sign in to post your reply or Sign up for a free account.