0

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.

2
  • put quotes around the filename show_my_file.php. Commented Mar 24, 2014 at 22:38
  • @JonathanKuhn sorry, the quote is a typo. still not working, any idea? Commented Mar 25, 2014 at 1:40

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

sorry, the quote is a typo. still not working, any idea?
i have tested your code an it works. mabe you are not calling jquery. add this on your head. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
0

Try this

  $('#container').load("show_my_file.php");

The file or path to the file should be in quote " "

3 Comments

i started answer and before click publish it appeared yours, as you ended sooner, should i delete my post?
@BlackPearl sorry, the quote is a typo. still not working, any idea?
Is the part to the file correct? If yes, try testing it on firefox
0
$(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') );
   }
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.