I started playing with prototype.js the past couple days, and have to say it's pretty neat stuff. It's been a bit of a chore though , since I don't really know javascript, but finally got a simple AJAX request working for a login page I'm playing with.

My problem now is how to do the redirect if the login is successful. My javascript is the following:
function showResponse(originalRequest)
{
$('LoginResult').update(originalRequest.responseText);
}
function checkLogin()
{
var url = 'ajax.a4p';
var params = 'UserID=' + $F('userid')+'&UserPassword=' + $F('userpassword');
new Ajax.Request(url, {method: "get", parameters: params, onComplete: showResponse});
}

ajax.a4p queries my web user table. If a valid record is found, it sets some session values, and redirects to the user's home page. If the login is invalid, it returns the text "Invalid Login", which the javasript then displays to the user. The problem is, the redirect doesn't really work, but rather displays the home page in the area where my invalid response normall shows on the login page. I get a page in a page kind of thing going (which is interesting in it's own right!).

So I know I need to modify my showResponse function to handle the redirect. Is there a simple way to get an A4D redirect called from the showResponse function?

Just having a problem trying to weave the javasript and A4D code together, and need a poke in the right direction. :)

Thanks,
Jason

_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to