Reputation: 65
I have a js function as below:
function show() {
$(document).ready(function() {
$('#container').load('show_my_file.php');
$('head').append( $('<link rel="stylesheet" type="text/css">').attr('href','show_my_file.css') );
})
}
This function is supposed to load the show_my_file.css to render #container (which now loads show_my_file.php), but it didn't work.
Does anybody how to how solve it? Thanks in advance.
Upvotes: 0
Views: 74
Reputation: 29
$(document).ready(function() {
function show() {
$('#container').load('show_my_file.php');
$('head').append( $('<link rel="stylesheet" type="text/css">').attr('href','show_my_file.css') );
}
});
Upvotes: 0
Reputation: 5949
the only thing i see wrong is the load(show_my_file.php); it should be
$('#container').load('show_my_file.php');
it worked with for me.
Upvotes: 1
Reputation: 2795
Try this
$('#container').load("show_my_file.php");
The file or path to the file should be in quote " "
Upvotes: 0