Synchronous Ajax Call in Mozilla.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    Synchronous Ajax Call in Mozilla.

    [CODE=javascript]
    function synchronous_aja x(){
    var ajax = null;
    if(typeof ActiveXObject!= 'undefined') ajax = new ActiveXObject(" Microsoft.XMLHT TP");
    else if(typeof XMLHttpRequest! ='undefined') ajax = new XMLHttpRequest( );
    else{alert('Aja x is not support!!!!!'); return;}

    alert('Yahoo: ' + ajax);
    ajax.open("GET" ,"http://www.google.co.i n/",false);
    ajax.send(null) ;
    alert(ajax.stat us);
    }[/CODE]

    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
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Permission is denied because it's from a different domain.

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #3
      Originally posted by acoder
      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

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Perhaps you're testing locally in IE?

        Comment

        • dmjpro
          Top Contributor
          • Jan 2007
          • 2476

          #5
          Originally posted by acoder
          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? :-)

          Comment

          • rnd me
            Recognized Expert Contributor
            • Jun 2007
            • 427

            #6
            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.

            Comment

            • dmjpro
              Top Contributor
              • Jan 2007
              • 2476

              #7
              Originally posted by acoder
              Perhaps you're testing locally in IE?
              So Ajax call can't be done to different Domain.

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                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.

                Comment

                • dmjpro
                  Top Contributor
                  • Jan 2007
                  • 2476

                  #9
                  Originally posted by acoder
                  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

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    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.

                    Comment

                    • gits
                      Recognized Expert Moderator Expert
                      • May 2007
                      • 5388

                      #11
                      or follow this link to the json-homepage :) to get more information about it ...

                      kind regards

                      Comment

                      Working...