Jquery Mobile局部刷新后js和css失效,需局部渲染

时间:2021-04-14 23:23:43

$(function () {
    $("#submit").click(function(){
     var storage = window.localStorage;
     var strTxtSno = encodeURI($("#sno").val());
     var index=$("#index");
     $("#divError").html("").show();
     $.ajax({  
      type : "get",                                                         
      url : "http://10.91.4.137:8080/zhihuiketang/Login",
      async:"false",
      dataType :"jsonp",
      jsonp:"callback",
      data: {Sno:strTxtSno},
      success: function (data) {
         var temp="";
         temp=temp+"<ul data-role='listview'>";
         $.each(data.result,function(i,value){
            temp=temp+"<li data-role='list-divider'>"+value.week+"</li>"
         });
         temp=temp+"</ul>";

}
         index.html(temp).show();
         $("div[data-role=content] ul").listview(); 
          }
        }
      });
     });
   });
   </script>