[OpenLayers-Users] XHTMLRequest being captured by OpenLayers

Matthew Pulis mpulis at gmail.com
Wed Dec 19 15:29:34 EST 2007


 

Hi,

 

I have tried to raise an asynchronous request to a webpage using
XMLHttpRequest(); and also YAHOO.util.Connect.asyncRequest; but both
requests are being caught by this exception :
try{(this.options['on'+event]||OpenLayers.Ajax.emptyFunction)(transport,json
);OpenLayers.Ajax.Responders.dispatch('on'+event,this,transport,json);}catch
(e){this.dispatchException(e);}

 

 

It is quite strange that none of the two requests are passing through, and I
also tried to use OpenLayers.loadURL to give me the same exception.

 

Any help how I can fix this problem is extremely appreciated.

 

Below please find the three different methods I tried to get the 2nd PHP
working. (Please note that I already have a loadURL being used for routing
and it works perfectly!)

 

Any help is extremely appreciated :)

 

Thanks for openlayers ;)

 

Matthew

 

 

-----------------------------------------------------------
XMLHttpRequest();  ------------------------------------------------ 

 

function openXMLrequest() {

                  var request = false;

                   try {

                     request = new XMLHttpRequest();

                   } catch (trymicrosoft) {

                     try {

                       request = new ActiveXObject("Msxml2.XMLHTTP");

                     } catch (othermicrosoft) {

                       try {

                         request = new ActiveXObject("Microsoft.XMLHTTP");

                       } catch (failed) {

                         request = false;

                       }  

                     }

                   }

 

           if (!request)

             alert("Error initializing XMLHttpRequest!");

                var tid = randomString();

                 var url = "http://localhost/~yancho/xml_parser.php?tid=" +
escape(tid);

                 request.open("GET", url, true);

                 request.onreadystatechange = updatePage();

                 request.send(null);

         }

 

         function updatePage() {

                   alert("Server is done!");

                    }

 

 

---------------------------------------------------
YAHOO.util.Connect.asyncRequest;
--------------------------------------------

 

        var handleSuccess2 = function(){

                    if(x.responseText !== undefined){

               alert("Server is done!");

                   }

          }

 

        var handleFailure2 = function(){

                if(x.responseText !== undefined){

                     alert("FAILURE!");

                }

        }

 

          var callback2 =

              {

                success:handleSuccess2,

                failure: handleFailure2

              };

         

           

         

         function openXMLrequest2 () {

           alert ('in openxml2');

           var tid = randomString();

           var url = "http://localhost/~yancho/xml_parser.php?tid=" +
escape(tid);

          // var x = YAHOO.util.Connect.asyncRequest('GET', url, callback2);

 

 

         }     

 

------------------------------------------------ 2nd OpenLayers.loadUrl()
---------------------------------------------       

 

        var handleSuccess2 = function(){

               alert("Server is done!");

            }

 

        var handleFailure2 = function(){

                     alert("FAILURE!");

        }

 

 

OpenLayers.loadURL(url,

                                   null,

                                   null, 

                                   handleSuccess2,

                                   handleFailure2);  

 

 

 

  _____  

I am using the free version of SPAMfighter for private users.
It has removed 18734 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter <http://www.spamfighter.com/len>  for free now!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20071219/170c000e/attachment.html


More information about the Users mailing list