jQuery $.cookie 不是函数 [英] jQuery $.cookie is not a function

查看:24
本文介绍了jQuery $.cookie 不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 jQuery 设置 cookie:

I am trying to set a cookie using jQuery:

$.cookie("testCookie", "hello");
alert($.cookie("testCookie"));

但是当我加载我的页面时,我收到错误$.cookie is not a function".以下是我所知道的:

But when I load my page, I receive the error "$.cookie is not a function". Here is what I know:

  • 我已经在这里下载了 jQuery cookie 插件.
  • 我正在链接到 jQuery,然后是 cookie 插件.
  • jQuery 和 jQuery.cookie 均以 200 OK 正确加载.
  • I have downloaded the jQuery cookie plugin here.
  • I am linking to jQuery and THEN the cookie plugin.
  • Both jQuery and jQuery.cookie are loading correctly with 200 OKs.

我查看了其他几个答案(此处此处 等),大多数人建议将 cookie.js 文件重命名为该文件.我已将我的 cookie 文件重命名为jquery.cookeee.js",但结果是一样的.

I have looked at several other answers (here and here among others), to which most people suggested renaming the cookie.js file. I have renamed my cookie file "jquery.cookeee.js" but the results are the same.

对这里发生的事情有什么想法吗?

Any ideas on what is going on here?

如果有帮助,我将在 MVC 4 中创建一个 Web 应用程序.

If it helps, I am creating a web application in MVC 4.

推荐答案

以下是我遇到的所有可能的问题/解决方案:

Here are all the possible problems/solutions I have come across:

$.cookie 不是标准的 jQuery 函数,需要下载插件 这里.确保在必要时包含适当的

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆