jquery loaded with ajax works in localhost but not on server
I have this code to load jquery content inside a div:
$(document).ready(function() {
$("#agile").click(function(event) {
$("#main").load("agile.php #container").hide().fadeIn(2000);
$.getScript("js/vTabs.js");
});
$("#apollo").click(function(event) {
$("#main").load("apollo.php #container").hide().fadeIn(2000);
$.getScript("js/vTabs.js");
});
$("#corner").click(function(event) {
$("#main").load("corner.php #container").hide(开发者_如何学C).fadeIn(2000);
$.getScript("js/vTabs.js");
});
});
I use the "$.getScript("js/vTabs.js);" to load the jQuery but this only works on local. On the server the content is displayed with no styles, which is part of what the .js does. I see on Firebug that the .js is being requested but still the styles it links to won't display.
I appreciate any guidance on this.
Finally solved it :) Changed .getScript for .bind.
This:
$("#agile").click(function(event) {
$("#main").load("agile.php #container").hide().fadeIn(2000);
$.getScript("js/vTabs.js");
});
for:
$("#agile").bind("click", function(){
$("#main").load("agile.php #container", function(){
$('#vtabs5').jVertTabs();
});
});
Of course, this applies to my particular example but it might guide someone else :)
精彩评论