drtzb06222 2013-03-03 01:08
浏览 112
已采纳

函数适用于jquery 1.4.2但不适用于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. 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:

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:

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.

  • 写回答

1条回答 默认 最新

  • duanjie6912 2013-03-03 01:12
    关注

    $ is basically jQuery call, if it is not defined, it does not load your jquery for some reason.

    Make sure that jquery is loaded correctly and that it is loaded before executing jquery ajax.

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型