No, changing the header doesn't fix it.
Arnd Wippermann wrote: > I would think, your Content-Type is wrong > > http://faq.openlayers.org/ajax/how-do-i-post-form-encoded-data/ > > Arnd Wippermann > > -----Ursprüngliche Nachricht----- > Von: [email protected] [mailto:[email protected]] Im > Auftrag von Bill Thoen > Gesendet: Sonntag, 11. Januar 2009 20:48 > An: [email protected] > Betreff: [OpenLayers-Users] Need Help with OpenLayers.Request > > Can somebody explain to me how to pass data to my server side program using > OpenLayers.Request? The following example seems to work, only there are no > variables in the $_POST array. My handler prints only: > > result is $_POST variables > > But apparently the array is empty. What am I missing here? > > Here's some sample code that illustrates the problem: > > <!-- test_ajax.html --> > <html> > <head> > <title>AJAX Test</title> > <script src="http://openlayers.org/api/OpenLayers.js" > type="text/javascript"></script> > <script type="text/javascript"> > > function init() { > var XHR = OpenLayers.Request.POST ({ > url: "test_ajax.php", > data: "my data", > params: {var1: 'value 1', var2 : 'value 2'}, > headers: { "Content-Type": "text/plain" }, > callback: myhandler > }); > } > > function myhandler(XHR) { > alert("result is " + XHR.responseText); > } > > </script> > </head> > <body onload="init();"> > <h1>AJAX Test</h1> > </body> > </html> > > > // --------------------- > // test_ajax.php > > <?php > > echo "\$_POST variables \n"; > > foreach($_POST as $key => $value){ > echo $key.": ".$value; > } > ?> > > > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users > > _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
