Multiple asynchronous requests (ajax)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Warning... this is ajax-related and not necessarily PHP (even though it
calls PHP scripts). I sent this to several JS lists, but haven't received a
response, so I thought I'd query this list to see if anyone here had an
idea.

~Philip


On 10/24/07, Philip Thompson <philthathril@xxxxxxxxx> wrote:
>
> Hi. I have this js function below. In it I grab the coordinates of where
> the user clicked (on the map). I want to take these coordinates and stuff
> 'em into a database, then display on the map where they clicked. Then I want
> to display some links in another div (not the map).
>
> [js code]
> function addPoint (e, imageId)
> {
>     var pl = new Array();
>     pl = map.pointLocation (e, CURRENT_POINT_SIZE);
>
>     var url = 'addPoint.php?x='+pl['x']+'&y='+pl['y']+'&size='+
>         CURRENT_POINT_SIZE+'&map='+imageId;
>     xmlHttpRequest (url, null, updateMap, 'GET');
>
>     url = 'updateForm.php?x='+pl['x']+'&y='+pl['y']+'&size='+
>         CURRENT_POINT_SIZE+'&map='+imageId;
>     xmlHttpRequest (url, null, updateForm, 'GET');
> }
>
> function xmlHttpRequest (url, vars, callbackFunction, requestMethod) {...}
> [/js code]
>
> Here, xmlHttpRequest is the method I call to perform the asynchronous
> requests. Ok, if I don't make the 2nd call to it, the points show up fine on
> the map (from the 1st request). If I make both calls, the points do NOT show
> up, but the links (from the 2nd request) appear.
>
> Is there an issue with calling this more than once? I tried setting a
> timeout for the 2nd request, but that didn't seem to help. Thoughts?
>
> Thanks in advance,
> ~Philip
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux