简体   繁体   English

函数在jquery 1.4.2上有效,但在jquery 1.9.1上无效

[英]function works on jquery 1.4.2 but not on jquery 1.9.1

I have this script for submitting some data to my database. 我有这个脚本用于向我的数据库提交一些数据。 It works great on 1.4.2 but the template I am using requires 1.9.1 so I updated my site. 它在1.4.2上运行良好,但我使用的模板需要1.9.1,所以我更新了我的网站。 The problem I am having is that I am now getting an error when I try to call the same function. 我遇到的问题是,当我尝试调用相同的函数时,我现在遇到错误。

Here is my js code: 这是我的js代码:

function drilldown(row_id){  
var dealID = document.getElementById('dealID'+ row_id).value;
var specialnotes = document.getElementById('specialnotes'+ row_id).value;
var ready = document.getElementById('ready'+ row_id).value;
var initials = document.getElementById('initials'+ row_id).value;
var forcust = document.getElementById('forcust'+ row_id).value;
var notes = document.getElementById('notes'+ row_id).value;

$.ajax({
    url: "savedrilldown.php",  
    type: "GET",
      //pass data like this 
    data: {dealID:dealID,specialnotes:specialnotes,ready:ready,initials:initials,forcust:forcust,notes:notes},    
    cache: false,
    success: function(data) {  
    if (data=="1")
    alert("Record updated!" );  
    } 

});  
}

And here is the error that firebug is showing me: 这是firebug向我展示的错误:

TypeError: $ is undefined [Break On This Error]     
$.ajax({

And here is what I am loading: 这是我正在加载的内容:

<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/jquery-migrate-1.1.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.9.2.min.js"></script>

Any advise would be appreciated. 任何建议将不胜感激。 Thanks very much. 非常感谢。

$ is basically jQuery call, if it is not defined, it does not load your jquery for some reason. $基本上是jQuery调用,如果未定义,则由于某种原因它不会加载您的jquery。

Make sure that jquery is loaded correctly and that it is loaded before executing jquery ajax. 在执行jquery ajax之前,请确保正确加载了jquery并且已将其加载。

Also I want to suggest to use json and data type json to transfer data since it has perfect form to be transmitted via json. 另外我想建议使用json和数据类型json来传输数据,因为它具有通过json传输的完美形式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM