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

Categories

I'm having a problem doing something very basic in jQuery. Can someone tell me what I'm doing wrong exactly?

If I run the code below, the function $.get seems to be missing (getJSON and others missing too). But $ itself and other functions do exist, so I know JQuery is loading.

google.load("jquery", "1.3.2");

function _validate(form, rules_file) {
   $.get('/validation_rules.json',function(data) {
     alert("hello")
   })
} 

Any ideas would be much appreciated.

Thanks, Rob

Edit: here is some additional info:

  <script src="http://www.google.com/jsapi"></script>
  <script>
    google.load("prototype", "1.6");
    google.load("scriptaculous", "1.8");
    google.load("jquery", "1.3.2");
  </script>
  <script>
    jQuery.noConflict(); // prevent conflicts with prototype
  </script>
  <script src="/livepipe/src/livepipe.js"
          type="text/javascript"></script>
  <script src="/livepipe/src/window.js"
          type="text/javascript"></script>
  <script src="/livepipe/src/tabs.js"
          type="text/javascript"></script>
  <script src="/jquery.maskedinput-1.2.2.js"
         type="text/javascript"></script>
See Question&Answers more detail:os

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

1 Answer

This will happen, too, if you use the SLIM version of jQuery.

<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>

gave me

>jQuery.get
:undefined
>jQuery.get()
:VM7130:1 Uncaught TypeError: jQuery.get is not a function
    at <anonymous>:1:8

while loading the same library without the slim option

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>

works well

jQuery.get() :Object {readyState: 1}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...