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

$(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>

原文地址:https://www.cnblogs.com/huangjian20112939/p/3489506.html