0

i have a function for select data in external file js

  function show_all() {
     work = "select";
      $.ajax({
          type: "POST",
          url: "server.php",
          data: "work="+work,
          success: function(data) {
              $("#boxtop").html(data);  
              $('#boxtop').animate({
              scrollTop: $('#boxtop').get(0).scrollHeight}, 0);
          } 
      });  
  }

and document ready work in html index but dont work in external file js

$(document).ready(function(e) {
   show_all();
});
Toprex
  • 155
  • 1
  • 9

1 Answers1

0

If I understand you right, you need to add this line to your index.html

<script type="text/javascript" src="yourscript.js"></script>

in a head section, where in src you should put a path to your external file

NamiraJV
  • 658
  • 1
  • 7
  • 11
  • This not my problem i added this line before .. my problem is whay document ready not work in external – Toprex Jan 29 '17 at 12:32
  • Then there are not enough details in your question. It might be invalid path to your file, some issues with jQuery, etc. Are there any error messages in the console? – NamiraJV Jan 29 '17 at 12:40
  • Try to read answers here: http://stackoverflow.com/questions/2194992/jquery-is-not-defined But it seems to me that It is a problem with jQuery. Check if it is included to your page and that it is included before your external file. – NamiraJV Jan 29 '17 at 12:56