OK,

I am well along here, able to connect, getting output from my test.php
script, however, my post data seems inaccessible to me.  I am passing
the coordinates of a user entered line-string to my script via post,
(excerpted from WFS.js and wfs-t.html), and while the alert prior to
sending shows the correct value of "data", I was assuming that I would
be able to see that data in my $_POST variable in the php script.
However, a print_r($_POST) yields an empty array.

 

Anyone have an idea of what I am missing?

 

Thanks,

r.b.

 

code:

 

        data = OpenLayers.Ajax.serializeXMLToString(data);

        alert(data);

        var responseObj = new OpenLayers.Ajax.Request(url,

                         {   method: 'post',

                             postBody: data,

                             onSuccess: function(transport) {

 
alert('Successful Connection');

 
},

                             onComplete: function(transport) {

 
alert(transport.responseText);

 
}

                          }

                         );

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Burgholzer,Robert
Sent: Monday, July 30, 2007 10:49 AM
To: [email protected]
Subject: Re: [OpenLayers-Users] returning text from simple ajax request

 

Ahh, I came across the following (after claiming it could not be done):

http://www.prototypejs.org/api/ajax/request

 

This has helped me. I was failing to specify an "onComplete" method, so
I was rushing to evaluate the response before it happened.

 

r.b.

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Burgholzer,Robert
Sent: Monday, July 30, 2007 10:37 AM
To: [email protected]
Subject: [OpenLayers-Users] returning text from simple ajax request

 

I am trying to do a simple request of data (just a dummy page as the
target for now), but I am missing some crucial understanding, as this is
not working for me. Any small guidance anyone could provide would be
helpful, I am very new to working with Ajax.

 

My goal at the time being is to simply initiate a request from a page,
and then alert the data returned by that page.  I assumed that an Ajax
request would be the right way to go.  I am initiating the request as
follows:

        Var url = 'test.php'

        var responseObj = new OpenLayers.Ajax.Request(url,

                         {   method: 'post',

                             postBody: data,

                             onComplete: success,

                             onFailure: failure

                          }

                         );

        var responseData = responseObj.transport.responseText;

        alert(responseData);

 

And the request IS being made, as verified by my httpd access log:

172.16.210.66 - - [30/Jul/2007:10:31:14 -0400] "POST /wms_maps/test.php
HTTP/1.1" 200 154

 

However, I can't seem to find the text that is generated by test.php in
my responseObj.  I am attempting to access this text with the
"responseText" property of my responseObj, but am getting only a blank
(whereas the script itself returns several lines of text).

 

Sorry if this is a dumb question, I have not been able to nabble any
successful tutorials on this. 

 

TIA,

r.b.

 

Robert W. Burgholzer

Surface Water Modeler

Office of Water Supply and Planning

Virginia Department of Environmental Quality

[EMAIL PROTECTED]

804-698-4405

Open Source Modeling Tools:

http://sourceforge.net/projects/npsource/

Web-Based Water Supply Planning Demo:

http://soulswimmer.dynalias.net/models/wsdemo/demo.php

 

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to