Hey folks,

i am really getting desperate here. I use jquery (current version)
with RoR 2.0.

Now i have a problem with a login-mask for users.

I fetch and submit typed in username and password like this:

-------- CODE ----------
        jQuery("#index_login_submit").click(function(event){
          jQuery.ajax(
            {success:function(request){$('#login').html(request);},
            url:"/authentication/login",
            data:"user_name="+jQuery('[EMAIL PROTECTED]').val()
+"&password="+jQuery('[EMAIL PROTECTED]').val(),
            async:false});

-----------------------------

As you can see, when the AJAX-call suceeds, the returned html is
injected into the login-div.
Among that injected html is a logout-button.

I "ajaxified" this logout-button like this:

-------- CODE ----------

        jQuery("#index_logout_submit").click(function(event){
          jQuery.ajax({success:function(request){$
('#login').html(request);}, url:"/authentication/logout",
async:false});
          event.preventDefault();
        });
-----------------------------

THE PROBLEM:

This login works fine and the logout-button is shown on successful
login, but now i have a weird problem:

- When i click on the logout-button directly after i logged in, the
click-event is not captured via javascript.
- A quick look into the generated page source tells me why: The logout-
button is _NOT_ existent in the page source-code although i can SEE
that logout-button when i look at the website in my browser.
- Only when i hit the browsers refresh-button page-view and page-
source are synchronous

What is happening here and how can i get this to work _without_ having
to hit the refresh-button?

Reply via email to