ajax局部刷新div学习

script

<script>
  function ajaxfresh(url){
    $.ajax({       type : "get",       async : false,       url : url,       data : '{type:1}',
      timeout : 3000,
      success : function(page){         $("#mainContent").html(page);       },       error : function(){         console.log("faild");       }     });   } </script>

 

div

<a href="#" onclick="ajaxfresh('./test1.html')">click</a>
<div id="mainContent"></div>

  

 

posted @ 2016-03-14 14:43  kkco  阅读(13530)  评论(1编辑  收藏  举报