[Javascript] Ajax question

tedd tedd at sperling.com
Sat Dec 30 13:17:52 CST 2006


At 10:54 AM -0800 12/30/06, Stephan Wehner wrote:
>>The following doesn't work:
>>
>>   <a onclick="javascript:sndReq('rock');"  href="" >Rock </a>
>>
>
>It's not clear to me what you mean by "doesn't work".

Sorry for my vagueness. The "doesn't work" remark simply means that 
the page doesn't refresh.

The 'rock' variable is sent to, and received, by the ajax routine.

>I think you should put the location.href assignment  in the asynchronous
>part of the AJAX request -- onComplete: in prototype.js.

[1] How?


>(I don't know what sndReq is). Are you seeing the sndReq - rock ; or
>are you not seeing the location.rhref='...' ?

The "sndReq(action)" is the typical sndReq() function associated with ajax.

-snip- back button considerations

You lost me there.

>What was your motivation?

The purpose of my investigation is to pass a variable between pages 
using php sessions and ajax.

I have no problems passing variables between pages using php 
sessions. I also have no problems using ajax to pass a variable to a 
php session. However, I can't get a ajax operation to pass a variable 
and refresh/redirect the browser to another page in one click.

I think [1] is the solution -- but how? I showed you what I ready tried.

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

How do you do it?

Thanks.

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



More information about the Javascript mailing list