Google Groups Home
Help | Sign in
How would I go about removing an element when an ajax request completes?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Haruki Zaemon  
View profile
 More options 19 Mar, 06:12
From: Haruki Zaemon <haruki_zae...@mac.com>
Date: Tue, 18 Mar 2008 23:12:26 -0700 (PDT)
Local: Wed 19 Mar 2008 06:12
Subject: How would I go about removing an element when an ajax request completes?
I'm using addBehavior to convert a number of form elements on a page
to use an AJAX request but when onSuccess is called there is no way
(that I can tell) to work out which form it was. Because the form
issues a backend delete, Ideally I'd like the client to remove the
form from the page.

Event.addBehavior({
  "form.delete": Remote.Form({
    onSuccess: function() {
      // Now I want to remove the form element but I can't
    }
  })


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Webb  
View profile
 More options 19 Mar, 07:47
From: "Dan Webb" <d...@danwebb.net>
Date: Wed, 19 Mar 2008 07:47:24 +0000
Local: Wed 19 Mar 2008 07:47
Subject: Re: How would I go about removing an element when an ajax request completes?

>  Event.addBehavior({
>   "form.delete": Remote.Form({
>     onSuccess: function() {
>       // Now I want to remove the form element but I can't

         this.element.remove();

>     }
>   })
>  });

--
Dan Webb
http://www.danwebb.net

aim: danwrong123
skype: danwrong


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Haruki Zaemon  
View profile
 More options 19 Mar, 09:38
From: Haruki Zaemon <haruki_zae...@mac.com>
Date: Wed, 19 Mar 2008 02:38:12 -0700 (PDT)
Local: Wed 19 Mar 2008 09:38
Subject: Re: How would I go about removing an element when an ajax request completes?
Hmm...I had tried that but I tried it again anyway and got the same
results: "this" is a [object DOMWindow] and "this.element" is
undefined. I presume because the onSuccess event is triggered by the
Ajax.Request?

On 19 Mar, 18:47, "Dan Webb" <d...@danwebb.net> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Webb  
View profile
 More options 19 Mar, 10:49
From: "Dan Webb" <d...@danwebb.net>
Date: Wed, 19 Mar 2008 10:49:26 +0000
Local: Wed 19 Mar 2008 10:49
Subject: Re: How would I go about removing an element when an ajax request completes?
Oh sorry, I didn't read your example properly.  At the moment you
can't set *Ajax.Request* event handlers via the behavior only
*element* event handlers.  Im working on it in the trunk but its not
finished yet.

On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:

--
Dan Webb
http://www.danwebb.net

aim: danwrong123
skype: danwrong


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Haruki Zaemon  
View profile
 More options 19 Mar, 10:52
From: Haruki Zaemon <haruki_zae...@mac.com>
Date: Wed, 19 Mar 2008 03:52:54 -0700 (PDT)
Local: Wed 19 Mar 2008 10:52
Subject: Re: How would I go about removing an element when an ajax request completes?
The event definitely gets fired and I have access to the response as I
would expect I just can't get at the Behaviour (as you stated). I
might just have to work around it for the time being by overriding
_makeRequest unless you can think of a better option?

On 19 Mar, 21:49, "Dan Webb" <d...@danwebb.net> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Webb  
View profile
 More options 19 Mar, 10:58
From: "Dan Webb" <d...@danwebb.net>
Date: Wed, 19 Mar 2008 10:58:05 +0000
Local: Wed 19 Mar 2008 10:58
Subject: Re: How would I go about removing an element when an ajax request completes?
When the work is complete this will refer to the behavior instance.
I'll get it finished soon.  Bear with me....in fact, I'll do it now :)

On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:

--
Dan Webb
http://www.danwebb.net

aim: danwrong123
skype: danwrong


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Haruki Zaemon  
View profile
 More options 19 Mar, 11:01
From: Haruki Zaemon <haruki_zae...@mac.com>
Date: Wed, 19 Mar 2008 04:01:20 -0700 (PDT)
Local: Wed 19 Mar 2008 11:01
Subject: Re: How would I go about removing an element when an ajax request completes?
You bloody legend! I'm certainly intrigued to see how you worked the
magic!

On 19 Mar, 21:58, "Dan Webb" <d...@danwebb.net> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Webb  
View profile
 More options 19 Mar, 11:21
From: "Dan Webb" <d...@danwebb.net>
Date: Wed, 19 Mar 2008 11:21:10 +0000
Local: Wed 19 Mar 2008 11:21
Subject: Re: How would I go about removing an element when an ajax request completes?
Grab this version from the trunk:

http://svn.danwebb.net/external/lowpro/trunk/dist/lowpro.js

It should work as expected.

On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:

--
Dan Webb
http://www.danwebb.net

aim: danwrong123
skype: danwrong


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Haruki Zaemon  
View profile
 More options 19 Mar, 11:29
From: Haruki Zaemon <haruki_zae...@mac.com>
Date: Wed, 19 Mar 2008 04:29:35 -0700 (PDT)
Local: Wed 19 Mar 2008 11:29
Subject: Re: How would I go about removing an element when an ajax request completes?
Works brilliantly. You deserve a medal! That is absolutely fantastic!

On 19 Mar, 22:21, "Dan Webb" <d...@danwebb.net> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Haruki Zaemon  
View profile
 More options 27 Mar, 02:25
From: Haruki Zaemon <haruki_zae...@mac.com>
Date: Wed, 26 Mar 2008 19:25:16 -0700 (PDT)
Local: Thurs 27 Mar 2008 02:25
Subject: Re: How would I go about removing an element when an ajax request completes?
I wanted to intercept on404 which wasn't in the list of callbacks so I
implemented onFailure and checked for response.status == 404. It'd be
nice to be able to implement the onNNN callbacks though. The simplest
approach I guess would be to just add every single one of them to the
on list. In my case I just add on404:

    $w('onCreate onComplete onException onFailure onInteractive
onLoading onLoaded onSuccess on404')

I realise that doesn't exactly scale BUT I couldn't think of any
others I cared about.

Cheers,

Simon

On 19 Mar, 22:29, Haruki Zaemon <haruki_zae...@mac.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.