[OpenLayers-Users] returning text from simple ajax request

Burgholzer,Robert rwburgholzer at deq.virginia.gov
Mon Jul 30 10:49:13 EDT 2007


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: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Burgholzer,Robert
Sent: Monday, July 30, 2007 10:37 AM
To: Users at openlayers.org
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

rwburgholzer at deq.virginia.gov

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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070730/0b791d86/attachment.html


More information about the Users mailing list