Javascript 未捕获类型错误:$。咆哮不是函数

Javascript 未捕获类型错误:$。咆哮不是函数,javascript,php,jquery,jgrowl,Javascript,Php,Jquery,Jgrowl,我一直收到一个“uncaughttypeerror:$。咆哮不是一个函数”错误。下面是我如何定义调用的,它显示了我是如何引用Growl的。我错过了什么?如何修复此错误 index.php <head> <title>HOST Continuous Integration</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <link rel="

我一直收到一个
“uncaughttypeerror:$。咆哮不是一个函数”
错误。下面是我如何定义调用的,它显示了我是如何引用Growl的。我错过了什么?如何修复此错误

index.php

<head>
    <title>HOST Continuous Integration</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link rel="stylesheet" type="text/css" href="HCIstyle.css">
    <link rel="shortcut icon" href="Images/wci_favicon.ico">
    <link href='http://fonts.googleapis.com/css?family=Armata' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Graduate' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,900' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Audiowide' rel='stylesheet' type='text/css'>
    <script src='https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js' type="text/javascript"></script>
    <script src='http://ksylvest.github.io/jquery-growl/javascripts/jquery.growl.js' type='text/javascript'></script> 
    <link href="http://ksylvest.github.io/jquery-growl/stylesheets/jquery.growl.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.11.1.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
<style type="text/css">
    .table_outer { height: 15em; overflow: auto; }
</style>

</head>

主机持续集成
 
.table_外部{高度:15em;溢出:自动;}
script.js是我调用咆哮函数的文件:

// This function is called when, in the Submit Tab,
// the "Check Gerrits" button is clicked.
$("#check_gerrits_button").click(function(event) {
    event.preventDefault();
    if ($("#gerrits").val() == "") {
        alert("Please enter gerrits.");
    } else {
        $("#main_form_su_validation_table").empty();
        var data = { 'product_lines' : [], 'gerrits' : [], 'contacts' : [],'component' : ($("#component").val())};
        //find all pl's that are checked
        $("input[name=product_line]:checked").each(function() {
           data['product_lines'].push($(this).val());
        });
        data['gerrits'] = ($("#gerrits").val()).split(",");
        data['contacts'] = ($("#contacts").val()).split(",");
        console.log("in chck gerrits");
        console.log(data);
        submitted = 'False';
        $.ajax({
            dataType: "json",
            type: "POST",
            url: "getsubmittedgerritsforSI.php",
            data: data,                        
            error: function (xhr, ajaxOptions, thrownError,response) {
                // send the error mail -TBD
                console.log(thrownError);
                console.log(xhr);
                alert(xhr.status);
                alert(thrownError);                         
            },
            success : function(response){
                console.log("get gerrits sucess");
                console.log(response);              
                var data_cp = [];
                var submittedlist = [];
                $("input[name=product_line]:checked").each(function() {
                  for (var si in response) {
                    console.log(response[si]);
                    for (var i = 0; i < response[si].length; i++) {
                        gerrit  = response[si][i]
                        data_cp.push(gerrit);
                    }
                  }
                });
                console.log(data_cp);
                var ui_gerrits = ($("#gerrits").val()).split(",");
                // this loop is to get the intersection of ui_gerrits and data_cp(database)
                for (var i = 0; i < ui_gerrits.length; ) {
                    for (var j = 0; j < data_cp.length; ) {
                        if (ui_gerrits[i] == data_cp[j] ){
                            submittedlist.push(ui_gerrits[i]);
                            submitted = 'True';
                        }                           
                        j++;
                    }
                    i++;
                }
                console.log(submittedlist);
                if (submitted = 'True' && submittedlist.length == ui_gerrits.length ){
                    //alert(str.fontcolor( "blue" ));
                    //$(function() { $.growl({ title: "Growl", message: "errits already released in SU or Submitted for SU!" })});
                    //$.growl(submittedlist + ": gerrits already released in SU or Submitted for SU");
                        $(function() {
                          $.growl({
                            title: "Growl",
                            message: "Gerrits already released in SU or Submitted for SU!"
                          });
                        });                 
                }else if ((submitted = 'True') && (submittedlist.length != 0) ){
                    //alert(str.fontcolor( "blue" ));
                    //$.growl(submittedlist + ": gerrits already released in SU or Submitted for SU \nPlease remove " + submittedlist + " and resubmit remaining gerrits"); 
                    $(function() {
                          $.growl({
                            title: "Growl",
                            message: "Gerrits already released in SU or Submitted for SU!"
                          });
                    });
                }
                else{
                    SUValidation(data, '#main_form_su_validation_table', '#gerrits', "main_form");          
                }
            }
        });     
    }    
});
    });
//在“提交”选项卡中,
//点击“检查Gerrits”按钮。
$(“#检查_gerrits_按钮”)。单击(函数(事件){
event.preventDefault();
if($(“#gerrits”).val()=“”){
警惕(“请输入gerrits。”);
}否则{
$(“#主表单#su#验证#表”).empty();
var数据={'product_line':[],'gerrits':[],'contacts':[],'component':($(“#component”).val())};
//查找所有已检查的pl
$(“输入[名称=产品线]:选中”)。每个(函数(){
数据['product_line'].push($(this.val());
});
数据['gerrits']=($(“#gerrits”).val()).split(“,”);
数据['contacts']=($(“#contacts”).val()).split(“,”);
console.log(“在chck gerrits中”);
控制台日志(数据);
提交='假';
$.ajax({
数据类型:“json”,
类型:“POST”,
url:“getSubmittedgeritsforsi.php”,
数据:数据,
错误:函数(xhr、ajaxOptions、thrownError、response){
//发送错误邮件-待定
控制台日志(thrownError);
console.log(xhr);
警报(xhr.状态);
警报(thrownError);
},
成功:功能(响应){
console.log(“GetGerrits Success”);
控制台日志(响应);
var数据_cp=[];
var submittedlist=[];
$(“输入[名称=产品线]:选中”)。每个(函数(){
用于(var si响应){
log(响应[si]);
对于(var i=0;i
您缺少jQuery库。jQuery咆哮插件依赖于jQuery库。您可以从类似CDN的目录中包含jQuery库,也可以在本地包含它。但是确保在jquery咆哮库之前包含它

下面是您的源代码的外观

<head>
  <link href="http://ksylvest.github.io/jquery-growl/stylesheets/jquery.growl.css" rel="stylesheet" type="text/css">
</head>
<body>
  <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
  <script src='http://ksylvest.github.io/jquery-growl/javascripts/jquery.growl.js' type='text/javascript'></script>
  <script type="text/javascript">
    $(function() {
      $.growl({
        title: "Growl",
        message: "errits already released in SU or Submitted for SU!"
      });
    });
  </script>
</body>

$(函数(){
一声怒吼({
标题:“咆哮”,
消息:“错误已在SU中发布或已提交给SU!”
});
});
另外,请阅读


更新
您有两个jQuery库,这是导致问题的原因。

问题的原因是jQuery文件的多个引用。咆哮之后的
jquery
文件将重新创建
$
实例,因此已注册的
growl
已被删除


请删除它或使用
jquery conflict

添加jquery了吗?这是什么意思?我的意思是,您是否包含jquery库?它似乎在这里工作。你能更具体一点吗?对不起,我还是不明白你在说什么库?@dhiraj-那么我缺少什么?jquery库?如何包括jquery库?你是否按照我的回答中的建议添加了Javascript文件?另外,确保咆哮方法位于页面末尾,如建议的那样。最后,请更新你的问题,你的文件到底是什么样子的,我添加了javascript文件,我已经有了它们,更新了主函数w