Ubuntu Uncaught ReferenceError中的Javascript错误:$未定义

时间:2022-11-05 14:07:44

I am working with jquery, javascript, php in Ubuntu Platform. In the page i am sending an ajax request through jquery to php file and getting response text. This program was running successfully in windows-(wamp) platform and online. But in Ubuntu i am getting javascript error. The code follows...

我在Ubuntu平台上使用jquery,javascript,php。在页面中我通过jquery发送ajax请求到php文件并获取响应文本。该程序在windows-(wamp)平台和在线成功运行。但在Ubuntu我收到javascript错误。代码如下......

    url = "index.php";

    $.get(url,{
            'action': 'Loan',
        },
        function(responseText){     
            alert(responseText);
        },
        "html"
    );

In Ubuntu i am getting this error, "Uncaught ReferenceError: $ is not defined". This error was showing at $.get line. In the script tag i included jquery library file too. I dont know why this is error is coming. Please solve my issue. Thanks in Advance.

在Ubuntu中我收到此错误,“未捕获的ReferenceError:$未定义”。此错误显示在$ .get行。在脚本标签中我也包含了jquery库文件。我不知道为什么这是错误即将来临。请解决我的问题。提前致谢。

3 个解决方案

#1


0  

$ is not defined on JQuery means the JQuery library is not loaded.

$未在JQuery上定义意味着未加载JQuery库。

It can happen due to many reasons such as,

它可能由于许多原因而发生,例如,

  1. Path on Windows is not same in Ubuntu.
  2. Windows上的路径在Ubuntu中并不相同。

  3. In windows file names are case insensitive but in Linux its case sensitive.
  4. 在Windows文件名中不区分大小写,但在Linux中它区分大小写。

I suggest you use JQuery from google.

我建议你使用谷歌的JQuery。

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
</script>

#2


0  

The error "Uncaught ReferenceError: $ is not defined" means that the JQuery library is not loaded.

错误“未捕获的ReferenceError:$未定义”表示未加载JQuery库。

You will find all CDN here to include the version of JQuery that you need

你会发现这里的所有CDN都包含你需要的JQuery版本

#3


0  

Instead of using the dollar sign use jQuery.get if it still not working trying verifying your jquery if it exists or not(404). If it exists, open maybe its just an empty file.

而不是使用美元符号使用jQuery.get,如果它仍然无法正常工作,尝试验证你的jquery是否存在(404)。如果它存在,打开它可能只是一个空文件。

#1


0  

$ is not defined on JQuery means the JQuery library is not loaded.

$未在JQuery上定义意味着未加载JQuery库。

It can happen due to many reasons such as,

它可能由于许多原因而发生,例如,

  1. Path on Windows is not same in Ubuntu.
  2. Windows上的路径在Ubuntu中并不相同。

  3. In windows file names are case insensitive but in Linux its case sensitive.
  4. 在Windows文件名中不区分大小写,但在Linux中它区分大小写。

I suggest you use JQuery from google.

我建议你使用谷歌的JQuery。

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
</script>

#2


0  

The error "Uncaught ReferenceError: $ is not defined" means that the JQuery library is not loaded.

错误“未捕获的ReferenceError:$未定义”表示未加载JQuery库。

You will find all CDN here to include the version of JQuery that you need

你会发现这里的所有CDN都包含你需要的JQuery版本

#3


0  

Instead of using the dollar sign use jQuery.get if it still not working trying verifying your jquery if it exists or not(404). If it exists, open maybe its just an empty file.

而不是使用美元符号使用jQuery.get,如果它仍然无法正常工作,尝试验证你的jquery是否存在(404)。如果它存在,打开它可能只是一个空文件。