[Javascript] Ajax question

tedd tedd at sperling.com
Sat Dec 30 11:24:49 CST 2006


Hi gang:

I realize that ajax is used to circumvent full page refreshes, but 
what if you want to refresh the page AND use ajax at the same time?

For example, my current js adventure is:

<a href="javascript:sndReq('rock');" >Rock </a>
<a href="javascript:sndReq('paper')" >Paper </a>
<a href="javascript:sndReq('scissors')" >Scissors </a>
<a onclick="location.href='';" >Refresh </a>

The above works -- and when I do a manual refresh I see that the 
variable "rock", "paper", or "scissors" has been sent to an ajax 
routine.

However, if I try to send AND refresh at the same time (i.e., below), 
I cant. The following doesn't work:

    <a onclick="javascript:sndReq('rock');"  href="" >Rock </a>

nor

    <a onclick="javascript:sndReq('rock'); location.href='';" >Rock </a>

nor

    <a onclick="javascript:sndReq('rock'); location.href='';" >Rock </a>

nor

    <a href="javascript:sndReq('rock');location.href='';" >Rock </a>

-- none work.

I'm getting the feeling that I can send only one request at a time. 
Anyone care to shed some light on this for me OR better yet, show me 
a way to communicate with an ajax routine and refresh a page with a 
single click?

Thanks.

tedd

-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com



More information about the Javascript mailing list