Search code examples
javascriptmootoolsmootools1.2

Update div after form send Mootools 1.1 to Mootools 1.2


I have this Mootools 1.1 script that is updating div after the form is submited ,

tried to convert it to mootools 1.2.4 but the log does not work and I am not getting any errors either

Mootools 1.1

        $('myform').addEvent('submit', function(e) {

            new Event(e).stop();
            var log = $('log_res').empty().addClass('ajax-loading');
            this.send({
                update: log,
                onComplete: function() {
                    log.removeClass('ajax-loading');

                }
            });
        }); 

mootols 1.2

        $('myform').addEvent('submit', function(e) {

            new Event(e).stop();
            var log = $('log_res').empty().addClass('ajax-loading');
            this.set('send',{
                update: log,
                onComplete: function() {
                    log.removeClass('ajax-loading');

                }
            }).send();
        }); 

Solution

  • try this:

         $('myform').addEvent('submit', function(e) {
    
            e.stop();
            var log = $('log_res').empty().addClass('ajax-loading');
            this.set('send',{
                url: this.get("action"),
                data: this,
                update: log,
                onComplete: function() {
                    log.removeClass('ajax-loading');
    
                }
            }).send();
        });