Jquery Library Function . load is not working!

Asked

Viewed 90 times

-1

<script>
$(".coment").load("coments.php #coments");
</script>

This function causes it to load the comments after sending it! This makes the comment be sent at the same time and displayed!

Only when I put this code to view the comments, it is not loading any comments! I checked if it is the div, if it is the "class" if it is the "id" but none will! I need help!

  • 2

    Daniel, welcome to Stack Overflow. I ask you to edit your question and add the full code of the html page that makes the request, as well as the.php coments script so that we can assist you in the best way possible.

1 answer

1

By the provided code snippet you may not have expected the page to load. Try using the method ready (https://api.jquery.com/ready/):

 <script type="text/javascript">
      $(document).ready(function()
               {
                  $(".coment").load("coments.php #coments");
               }
      );
 </script>
  • 1

    Still won’t go man! Nor the function he is calling! There must be something that’s conflicting with the library, and it’s not letting you start the function, something like that! It must be...

  • So it could be a plethora of things. As @Bruno Bermann commented on your question, you might : 1) Don’t have jQuery installed (make sure jQuery is not null), 2) your page coments.php does not exist , 3) the element #coments does not exist on the page or is not being rendered, etc.Provide more evidence so that we can help you!

  • Guys, I found the problem, I was doing this code above the <src="jquery.min.js"></scrtipt> That is, he was pulling a function that he did not understand, because it was above the Library. And he was not recognizing ...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.