标签:
1.JQuery的load函数
<script>
$(function(){
$("#d1").load("page.html");//需要加载的页面
$.ajax({
type:"get",
url:"http://localhost:3000/showAll",
dataType:"jsonp",
jsonpCallback:"cb",
success:function(param){
alert(param);
}
});
});
</script>
2.AngularJs
<script>
angular.module("indexMain",["ngRoute","controllerModule"])
.config(function($routeProvider){
$routeProvider.when("/",{templateUrl:"page1.html",controller:"Page1Controller"});
$routeProvider.when("/page1",{templateUrl:"page1.html",controller:"Page1Controller"});
$routeProvider.when("/page2",{templateUrl:"page2.html"});
$routeProvider.when("/page3",{templateUrl:"page3.html"});
});
angular.module("controllerModule",[])
.controller("Page1Controller",function($scope){
$scope.name = "aaa";
});
</script>
//Html中
<ul>
<li><a href="#page1">页面一</a></li>
<li><a href="#page2">页面二</a></li>
<li><a href="#page3">页面三</a></li>
</ul>
标签:
原文地址:http://www.cnblogs.com/yttbbd/p/4862579.html