Javascript Jquery代码重定向html页面?
我想理解这意味着:“url:‘Show.html’”。 这是对html页面的重定向吗? 因为我使用相同的代码进行测试,并且没有重定向 我有以下代码:Javascript Jquery代码重定向html页面?,javascript,jquery,html,Javascript,Jquery,Html,我想理解这意味着:“url:‘Show.html’”。 这是对html页面的重定向吗? 因为我使用相同的代码进行测试,并且没有重定向 我有以下代码: function showAll(){ $("#contentCamp").empty(); $.ajax({ url: 'Show.html', dataType: 'html', success: function(data){ $("#contentCamp").html(
function showAll(){
$("#contentCamp").empty();
$.ajax({
url: 'Show.html',
dataType: 'html',
success: function(data){
$("#contentCamp").html(data);
getAll();
},
error: function(e){
alert("Error loading all html : " + e.statusText);
}
});
}
还有其他的功能
function getAll(){
var response;
var all = [];
$.ajax({
type: 'Post',
url: url + 'GetAll',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(msg){
response = msg.d;
for(var i=0; i < response.length; i++){
all[i] = [response[i].name];
}
fill(all);
},
error: function(e){
alert("error loading");
}
})
}
function fill(data) {
if ($("#table").css("visibility") == "hidden")
$("#table").css("visibility", "visible");
$('#table').dataTable({
'aaData' : data,
'aoColumns' : [{ "sTitle":...}
});
函数getAll(){
var反应;
var all=[];
$.ajax({
键入:“Post”,
url:url+GetAll,
contentType:'application/json;charset=utf-8',
数据类型:“json”,
成功:功能(msg){
响应=msg.d;
对于(变量i=0;i}不,这不是重定向调用,只是从中获取内容的页面不,这不是重定向,而是Ajax调用,从
Show.HTML
侧边获取HTML
。注意:为什么不简单地使用$(“#contentCamp”).load('Show.HTML',function(){getAll()})因为在我朋友的代码中,他有一个显示all元素的链接,下面是他的代码:。因此,他没有重定向新页面,他只是用show.html替换当前的html页面。对吗?