Mootools和jQuery之间的冲突

时间:2014-02-16 22:00:42

标签: jquery mootools

我有一个在登录doLogin.php文件后执行的脚本。成功后,php代码退出('OK');当它是mootools时,只有一切都很完美。现在当我试图去jquery时,我在/dologin.php上只有一个带有OK消息的空白页面。你能帮我解决这个问题吗?我试图改变一些功能,但不起作用。

Jquery Attempt

$(document).ready(function() {
        jQuery.fn.addEvent = jQuery.fn.bind; //updated
    $('login').bind('submit', function(e) {
        // Prevents the default submit event from loading a new page.
        e.stop();

        // Show the spinning indicator when pressing the submit button...
        $('ajax_loading').css('display','block');

        // Hide the submit button while processing...
        $('submit').css('display','none');
        $('register').css('display','none');

        // Set the options of the form's Request handler.
        // ("this" refers to the $('login') element).
        this.set('send', { onComplete: function(response) {
            $('ajax_loading').css('display','none');

            if(response == 'OK'){
              $('status').set('html', '<div class="col-md-6"> '+
                                      '<div class="panel panel-primary">'+
               ' <div class="panel-heading">'+
                   ' <h3 class="panel-title">'+
                   '     <span class="fa  fa-cog"></span> Quick Redirect</h3>'+
                '</div>'+
               ' <div class="panel-body">'+
              '      You are now logged it! <br />'+
             ' <div class="progress progress-striped active">' +
               ' <div style="width: 100%" class="progress-bar"></div>' +
             ' </div>'+
              '      </div>'+
           ' </div>'+
        '</div>' );


            setTimeout('go_to_private_page()', 3000);
            }
            else
            {
               $('login_response').set('html', response);
              // Show the login button
              $('submit').setStyle('display','');
              $('register').setStyle('display','');
            }
        }});

        // Send the form.
        this.submit();
    });
});

function go_to_private_page()
{
window.location = 'admin/index.php'; // Members Area
}

原始文件

window.addEvent('domready', function() {

    $('login').addEvent('submit', function(e) {
        // Prevents the default submit event from loading a new page.
        e.stop();

        // Show the spinning indicator when pressing the submit button...
        $('ajax_loading').setStyle('display','block');

        // Hide the submit button while processing...
        $('submit').setStyle('display','none');
        $('register').setStyle('display','none');

        // Set the options of the form's Request handler.
        // ("this" refers to the $('login') element).
        this.set('send', { onComplete: function(response) {
            $('ajax_loading').setStyle('display','none');

            if(response == 'OK')
            {
              $('status').set('html', '<div class="col-md-6"> '+
                                      '<div class="panel panel-primary">'+
               ' <div class="panel-heading">'+
                   ' <h3 class="panel-title">'+
                   '     <span class="fa  fa-cog"></span> Quick Redirect</h3>'+
                '</div>'+
               ' <div class="panel-body">'+
              '      You are now logged it! <br />'+
             ' <div class="progress progress-striped active">' +
               ' <div style="width: 100%" class="progress-bar"></div>' +
             ' </div>'+
              '      </div>'+
           ' </div>'+
        '</div>' );


            setTimeout('go_to_private_page()', 3000);
            }
            else
            {
               $('login_response').set('html', response);
              // Show the login button
              $('submit').setStyle('display','');
              $('register').setStyle('display','');
            }
        }});

        // Send the form.
        this.send();
    });
});

function go_to_private_page()
{
window.location = 'admin/index.php'; // Members Area
}

0 个答案:

没有答案