Don''t have your server return code that needs to be executed if you
can possibly avoid it. You should be able to achieve the same effects
while keeping the executable javascript on the client side and having
the server return just information that tells the javascript what to
do, plus objects and other information (including forms etc.) to be
placed here and there. Life is much simpler and your pages stay much
more maintainable this way.
Hope you found the solution by now --
On Apr 9, 12:53 pm, darkmessenger88
<darkmessenge...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hey everybody,
>
> Okay, to start off, I''m pretty new to prototype, so please bear
with
> me if i''m missing something obvious.
>
> I''m trying to make a website with a completely ajax frontend, with
a
> php/mysql backend. For my login script, the user types a username/pass
> and clicks submit (which is a button that calls a js function). the JS
> function requests a new encryption seed from the server, then combines
> the password and the seed and hashes them, then sends both the
> username and the pass to the server. The php file returns javascript
> code which dynamically modifies the page.
> ->red error box appears if login failed
> ->user menu if login succeeded
> ->admin menu if user is admin
>
> in the error box, there is a link to try logging in again. The link
> has an onclick which calls a js function that removes the red box and
> puts the original login form in its place, complete with the submit
> button wired with an onclick to get a new login seed.
>
> my problem is that when i go to the page, i can click the button, and
> see the ajax requests get the seed and send the password. my blank
> login fails, so it shows the link to try again. when i click try
> again, it shows the original login form. but when i click the submit
> button again, it sends the first ajax request, but not the second.
>
> the submit button is calling the same function both times, and i can
> step through the javascript code and see that the first ajax request
> succeeds, thereby calling the function for the second one. But the
> prototype code never ends up making a second ajax request.
>
> I was wondering if it was running out of memory, but that seems kinda
> crazy. these are <1kb text requests.
>
> Any ideas?
>
> -darkmessenger
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---