I''m developing an application that requires knowledge of presence for a web page. When the user leaves (onunload), I do an Element#insert followed by a synchronous XHR: $("layoutMessages").insert(''<p class="warning">Leaving Draft ...</ p>''); new Ajax.Request(''/drafts/1/leave'', {asynchronous:false, evalScripts:true, method:''delete'', parameters:''authenticity_token='' + encodeURIComponent(''30858d71f4666124c22abcd63b24c6e3b7c31db1'')}) } The insertion never appears in the browser. Is there a way to ensure that it will? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Not sure what you''re asking. Are you trying to do an update (replace the contents of the element) or an insert? Insert takes a hash: $("layoutMessages").insert({before: "asdf"}); $("layoutMessages").insert({after: "asdf"}); $("layoutMessages").insert({top: "asdf"}); $("layoutMessages").insert({bottom: "asdf"}); On Wed, Jun 4, 2008 at 1:15 PM, richcollins <richcollins-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m developing an application that requires knowledge of presence for > a web page. When the user leaves (onunload), I do an Element#insert > followed by a synchronous XHR: > > > $("layoutMessages").insert(''<p class="warning">Leaving Draft ...</ > p>''); new Ajax.Request(''/drafts/1/leave'', {asynchronous:false, > evalScripts:true, method:''delete'', parameters:''authenticity_token='' + > encodeURIComponent(''30858d71f4666124c22abcd63b24c6e3b7c31db1'')}) > } > > The insertion never appears in the browser. Is there a way to ensure > that it will?-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That''s weird. Everything looks fine (except that "asynchronous" is already set by default). Is server receiving request, or does nothing at all happens on "unload"? - kangax On Jun 4, 2:15 pm, richcollins <richcoll...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m developing an application that requires knowledge of presence for > a web page. When the user leaves (onunload), I do an Element#insert > followed by a synchronous XHR: > > $("layoutMessages").insert(''<p class="warning">Leaving Draft ...</ > p>''); new Ajax.Request(''/drafts/1/leave'', {asynchronous:false, > evalScripts:true, method:''delete'', parameters:''authenticity_token='' + > encodeURIComponent(''30858d71f4666124c22abcd63b24c6e3b7c31db1'')}) > } > > The insertion never appears in the browser. Is there a way to ensure > that it will?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---