Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
405 views
in Technique[技术] by (71.8m points)

javascript - JQuery Error: Uncaught TypeError: Object #<HTMLDocument> has no method 'ready'

my site is getting the error in this title in the javascript console. Google seems to say that it is because jquery isn't loaded, but it is definitely visible in the head.

<script type="text/javascript">
  $(document).ready(function(){
    $.ajax({
      type: "GET",
      url: "https://www.mjfreeway.com/naturalremedies/mml-connect/45.xml",
      dataType: "xml",
      success: function(xml) {
        $(xml).find("products").each(function() {
          $(this).find("product").each(function() {
            $("#output").append($(this).find("title").text() + "<br />");
          });
        });
      }
    });
  });
</script>

the site is medical marijuana related, so nsfw for some.sorry for the messy head, it's in dev mode. http://www.kindreviews.com/1/mmc/

Thanks, zeem

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Apparently you are using both jQuery and Mootools and both of them do use $ as an alias to a core function. Probably the $ function which is generating this error is the Mootools function. I'd suggest you to try to write your jQuery code using jQuery instead of $ so you can confirm my point is right or not.

Good luck!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...