【发布时间】:2016-01-29 05:25:29
【问题描述】:
代码是显示与部门相关的指定表格。索引页面包含页面链接和 HTML 页面加载到的 div。 加载页面后获取表ID并隐藏表然后调用AJAX检查隐藏表是否分配给该部门,如果显示隐藏表,则该过程继续进行,直到获取页面中的所有表ID。
**JS**
//loading an html page to a div of index.html
$('#showData').load('1.Org.html);
//Show hide come here
function showData(department){
$("#showData table").each(function(){
//$("#testDiv table").each(function(){
var gid=$(this).attr("id");
var gidnew=gid.replace(/\./g,'\\.');
$('#' +gidnew).hide();
console.log("hide:"+gidnew+"department:"+department);
$.ajax({
url : "/BP/selectGroup/"+department+"/"+gid,
async: false,
success : function(data){
var obj = jQuery.parseJSON(data);
for(i = 0; i < obj.length; i++) {
var gid=obj[i].group_id;
gid=gid.replace(/\./g,'\\.');
$('#'+gid).show();
//$("#showData").load('#'+gid);
console.log("show"+gid);
}
$("#loading").hide();
},
error: function(errorThrown){
console.log(errorThrown); // If there was an error it can be seen through the console log.
}
});
console.log("aftr ajax::department:"+department);
});
}
【问题讨论】:
-
问题是什么?
-
代码在 localhost 中运行良好,但在服务器上托管时,即使在 show() 之后指定的表也不会在 div 上显示任何内容
-
请在您的网站中按 ctrl+u 然后单击 js 文件以检查您的 js 是否存在于您的文件夹项目中,我想这是问题
-
我检查了它有没有js文件