ajax loader没有在phonegap android中工作

时间:2013-08-01 10:23:14

标签: sqlite jquery jquery-mobile cordova

我正在使用phonegap android,其中我使用了sqlite数据库来存储数据。我的程序运行完美,但我的ajax加载器不是cuming plz帮我解决我在程序中做的错误,我的ajax加载器没有cuming

在jquery中的

: -

     function get_Emp_List() {             
       $("#employee").empty();

       $(location).attr('href', '#emp1');
       $.support.cors = true;   
       $.ajax({
            type: "GET",
            url: "one.html",
            contentType: "text/xml",
            dataType: "xml",
            data: "",
             beforeSend:function () { 
                 $.mobile.loading('show',{
                  text: "Loading...",
                   textVisible: true,
             theme: "d",
             textonly: false,
             html: ""
          });
          },
          complete:function () {     
              $.mobile.loading('hide');
          },
        crossDomain:true,
            success: function (data) {                  
                      $(data).find("employee").each(function () {   

                      var emp_id = $(this).find('id').text();
                      var emp_name = $(this).find('short_name').text();


                       db.transaction(function(transaction) {
                             transaction.executeSql('INSERT INTO Envy_Emp VALUES((SELECT max(_idEE)+1 FROM Envy_Emp),"'+emp_id+'","'+emp_name+'")',nullHandler,errorHandler);
                        });
                         });                     
                 ids_Dynamic_Emp_List();

                      return false;
                   },
            error: function (data) {
                    alert("error");
            }
        });     
    }

      /*  end Employee list script */

    /*ids_Dynamic_Emp_List() method coding Start*/ 

       function ids_Dynamic_Emp_List(){
           /*sql start*/

        /*sqlite code for dynamic Emp list*/
      db.transaction(function(tx){
        tx.executeSql('SELECT * FROM Envy_Emp;', [], 

    function(tx,results){

               if (results != null && results.rows != null) { 
                var myLen=results.rows.length;
                 for (var i = 0; i < results.rows.length; i++) {
                     var for_Name = results.rows.item(i).Envy_Emp_Name;
                     var for_ID = results.rows.item(i).Envy_Emp_ID;
                     var for_E_ID=results.rows.item(i)._idEE;
                    /*create table list Dynamically using Sqlitedata base */
                         var scripts = "<a href='#' data-role='button' data-theme='b' data-inline='true' onclick='get_Menu_List(id);' id='"+for_E_ID+"'>"+for_Name+"</a>";
                         alert(scripts);
                      $(".employee1")
                      .append(scripts)
                      .trigger('create');
                    /*create table list Dynamically using Sqlitedata base End*/ 
                    }
                  }
               },errorHandler);
              }
             ,errorHandler,nullHandler);
             return; 
              }

0 个答案:

没有答案