[OpenLayers-Users] OpenLayers.Request.POST/GET errors

Heidt, Christopher M. CHRISTOPHER.M.HEIDT at saic.com
Tue Oct 7 17:55:52 EDT 2008


params are added to the get string and data is added to post data, both
need to be objects.
 
have you tried:
new OpenLayers.Request.issue({
    method: 'POST',
    url:'http://www.host.com/lib/printMap.php
<http://www.host.com/lib/printMap.php> ',
    params: {
        getStringItem1:'cheesburger',
        item2:'wambat'
    },
    data:{
        postedUsername: 'myUsername',
        postedPassword: 'myPassword'
    },
    success: function(request){
        alert(request.responseText);
    },
    failure:function(request){ 
        alert('BOOOOOO!');
    }
});
 
and have you checked the $_GET and $_POST arrays in PHP? the request
array is usually frowned upon.
 

________________________________

From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Ian
Sent: Tuesday, October 07, 2008 4:53 PM
To: users at openlayers.org
Subject: [OpenLayers-Users] OpenLayers.Request.POST/GET errors


I am working on the Printing code from the wiki using the new ver. 2.7
OpenLayers.Request.POST/GET. The problem is that data is not appearing
in PHP's @$_REQUEST array. For example:

var printURL = 'http://www.host.com/lib/printMap.php';
var size = map.getSize();
var postParams = 'width=' + size.w + '&height=' + size.h;
new OpenLayers.Request.POST({url:printURL, data:postParams,
callback:printDone});

results in an empty REQUEST array. Firebug says width=500&height=500 is
posted. Same for GET:

var printURL = 'http://www.host.com/lib/printMap.php';
var size = map.getSize();
var getParams = {width: size.w, height: size.h};
new OpenLayers.Request.GET({url:printURL, params:getParams,
callback:printDone});

Submitting parameters directly (eg.
http://www.host.com/lib/printMap.php?width=500&height=400) does place
the values in the REQUEST array. I'm following the examples at
http://trac.openlayers.org/wiki/Request and using Apache 2/PHP
5.2.6/Firefox 3.03. Am I missing something?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081007/8d1085ca/attachment.html


More information about the Users mailing list