Re: XMLHttpRequest - call direct action using relative URL
Re: XMLHttpRequest - call direct action using relative URL
- Subject: Re: XMLHttpRequest - call direct action using relative URL
- From: Chuck Hill <email@hidden>
- Date: Wed, 22 Sep 2010 23:25:06 -0700
On Sep 22, 2010, at 11:18 PM, Andri vonAllmen wrote:
> Hi List,
>
> I'd like to call a direct action method using XMLHttpReqest in a JavaScript. The snippet below shows how the request is made:
>
> var xmlHttp;
> xmlHttp=new XMLHttpRequest();
> xmlHttp.open("GET", "/cgi-bin/WebObjects/[APP_NAME].woa/wa/[CLASS_NAME]/[METHOD_NAME]?wosid=[SID]", true);
> xmlHttp.send();
>
> If using a relative URL (as shown above) the request is processed only once per session (if doing it repeatedly), but not if using an absolute URL instead ("http://[HOST]:[PORT]/cgi-bin/WebObjects/[APP].woa/wa/[CLASS]/[METHOD]?wosid=[SID]"). Since it is not possible to use the servers IP address instead of its host name, and, in my case, the servers are not accessible through a host name in every case, I have to use the relative URL. The relative URL is generated using the WOContexts directActionURLForActionNamed method.
>
> Any hints, how I can get this working using relative URLs, are kindly appreciated.
Try appending a random number parameter to the URL:
... ?wosid=[SID]&_r=[RANDOM NUMBER]...
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden