[OpenLayers-Users] OpenLayers.Request.POST
Tim Schaub
tschaub at opengeo.org
Thu Jul 24 15:13:19 EDT 2008
Hey-
Fabio D'Ovidio wrote:
>
>
> Tim Schaub ha scritto:
>> Hey-
>>
>> Fabio D'Ovidio wrote:
>>
>>> Hello,
>>> I'm trying to pass some values using POST method and
>>> OpenLayers.Request as following:
>>> // POST
>>> var data = this.idOperazione(); //my function returns my
>>> values to pass
>>> var url = "myUrl";
>>> var request = OpenLayers.Request.POST({
>>> url: url,
>>> data: data,
>>> headers: {
>>> "Content-Type": "application-xml"
>>> },
>>> callback: handler
>>> });
>>>
>>> I have an error in using it...
>>> uncaught exception: [Exception... "Component returned failure code:
>>> 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.send]"
>>> nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame
>>> :: javascript: eval(__firebugTemp__); :: anonymous :: line 1" data: no]
>>>
>>>
>>
>> In case you aren't aware of it, read about the same origin policy:
>> http://en.wikipedia.org/wiki/Same_origin_policy
>>
>> For a convenient way to use a proxy with OpenLayers, read about the
>> OpenLayers.ProxyHost property:
>> http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#ProxyHost
>>
>>
>> Tim
>>
>
>
> Hi Tim!
> Thanks for your replay but I think your answer isn't appropiate with my
> question. I know the problem you explained me, in fact I redirected my
> request to localhost, it isn't a problem! It works !
> My question was:
> How can I send data using POST method?
> I tryed as following:
>
> var request = OpenLayers.Request.POST({
> url: url,
> data: data,
> headers: {
> "Content-Type": "application-xml"
> },
> callback: handler
> });
>
> is it the right way ?
Yes, that is the right way.
As Eric hints in his message, your content type header is funky though
(you likely want application/xml instead of application-xml). However,
that wouldn't stop the request from being issued.
Tim
> That's all!
>
> Thanks
>
>
>
> !DSPAM:4033,48858efa29001015089218!
>
More information about the Users
mailing list