Streamlined that slightly for you (assuming you're using 1.2) ;)

    $('subscribeform').addEvent('submit', function(e){
           new e.stop();
           this.set('send', {
                url: '/lists/?p=subscribe&id=2',
                method: 'post',
                onFailure: function(){
                        alert('fail!');
                },
                onRequest: function(){
                        alert('on req');
                },
                onSuccess: function(responseText, responseXML){
                        $('newsletter-content').set('html',
responseText);
                },
                onStateChange: function(){
                        alert('on change');
                }
           }).send();
   });

On Sep 11, 6:00 am, "ful.cleane" <[EMAIL PROTECTED]> wrote:
> Got it!
>
> Does turn out that most of the suggestions I've seen on boards don't
> really apply to POST as much as they do to GET.
>
> But after diving back through the API (and a little time at the
> bookstore) I figured it out.
>
> This works like a charm for a form with a regular [input type=submit]
> button with [form id=subscribeform]:
>
>     $('subscribeform').addEvent('submit', function(e) {
>            new Event(e).stop();
>            $('subscribeform').set('send', {
>                 url: '/lists/?p=subscribe&id=2',
>                 method: 'post',
>                 onFailure: function() {
>                         alert('fail!');
>                 },
>                 onRequest: function() {
>                         alert('on req');
>                 },
>                 onSuccess: function(responseText, responseXML) {
>                         $('newsletter-content').set('html', responseText);
>                 },
>                 onStateChange: function() {
>                         alert('on change');
>                 }
>            });
>            $('subscribeform').send();
>    });
>
> Hope this is useful for someone with the same problem.

Reply via email to