[Javascript] Ajax question

Paul Novitski paul at juniperwebcraft.com
Sat Dec 30 17:34:19 CST 2006


At 12/30/2006 03:13 PM, tedd wrote:
>Same thing. The following ALL load the next page:
>
><a href="javascript:sndReq('rock');location.href='';" >Rock </a>
><a href="javascript:sndReq('rock');location.href='?';" >Rock </a>
><a href="javascript:sndReq('rock');location.href='index.php';" >Rock </a>
>
>But, none also send the variable "rock" to ajax.
>
>It works like this -- I can either send the variable "rock" OR 
>launch the next page, but not both!


I wonder if what's happening is that the page redirect cancels out 
all pending requests.  This would make sense -- when you click on a 
link on a page that's still downloading, you want it to redirect 
immediately and not wait for the first page to resolve.  I would 
think that from the server's point of view, once the client asks to 
redirect, all previously pending requests from that client should be 
cancelled so it doesn't waste resources trying to deliver content to 
a client that's no longer interested.

If this model applies to your situation then you might be able to 
work around it by imposing a delay between the two requests.  But how 
long a delay?  Would it depend on connection speed and bandwidth traffic?

I agree with Mike -- don't make pages that break in the absence of javascript.

If you're avoiding GET because you don't want values visible in the 
querystring, have you considered using POST?  That way you can go to 
your next page and submit hidden values to a server-side script (for 
setting the session variables) in one operation.

Regards,
Paul 




More information about the Javascript mailing list