滑动和注册不能同时工作

时间:2013-06-12 12:44:10

标签: ajax forms zend-framework jquery-mobile swipe

我正在使用Zend框架版本1.11.3和jquery移动版本1.3.0-beta.1。我的刷卡和注册不能同时工作。他们个人工作正常。我试图改变他们的立场,但都是徒劳的。这是我的代码 - 登记表格代码:

  <script>
    $('#1').on('pageshow', function(event) {
      $(document).on('click','#submit_button',function(e) {
        if (validatefName() & validatelName() & validateEmail()) {
            $.ajax({
                    errorElement : "em",
                    type : "POST",
                    url : "index/saveregister",
                    data : $('#registerForm').serialize(),
                    success : function(e) {
                     // e is for detecting if the meail address already exists in the database.
                            if (e == 1) {
                                console.log("success");
                                //location.reload();
                                $("#message").html('<h2 style="color:green"><center><br>Thank you for registering with us .</center></h2>');
                            }
                            if (e == 0) {
                                // If email address exists in the database already
                                //alert("e is zero");
                                $('#message').html('<h2 style="color:red">Please check ur email address</h2>');
                                return false;
                            }
                        },
                        error : function(data1, st, rr) {

                            alert("ajax error");
                        }
                    });
                    //ajax requests

                    return true;
                } else {
                    return false;
                }
               });
           });
    </script>

滑动代码:

     $( document ).on( "pageinit", "[data-role='page'].swipe-page", function() {
         var page = "#" + $( this ).attr( "id" ),
         next = $( this ).jqmData( "next" ),
         prev = $( this ).jqmData( "prev" );
         if ( next ) {
         // Prefetch the next page
           $.mobile.loadPage( next  );
          // Navigate to next page on swipe left
          $( document ).on( "swipeleft", page, function() {
              $.mobile.changePage( next );
          });
        }
       if ( prev ) {
          $( document ).on( "swiperight", page, function() {
               $.mobile.changePage( prev , { reverse: true } );
            });
           }
       }); 

任何帮助将不胜感激

0 个答案:

没有答案