Jquery mobile 检查jQuery移动应用程序中是否存在cookie

Jquery mobile 检查jQuery移动应用程序中是否存在cookie,jquery-mobile,cookies,hybrid-mobile-app,icenium,Jquery Mobile,Cookies,Hybrid Mobile App,Icenium,我试图在beforeSend事件中发送ajax请求之前验证jQuery移动应用程序中是否存在cookie,但执行此操作的代码行引发以下异常:uncaughttypeerror:Object function(e,t){return new b.fn.init(e,t,r)}没有方法“cookie” 我的问题:检查jQuery移动应用程序中是否存在cookie的正确方法是什么,或者这在当前版本的jQuery移动应用程序中是不可能的?我正在Icenium开发混合移动应用程序 我使用的代码如下 fun

我试图在beforeSend事件中发送ajax请求之前验证jQuery移动应用程序中是否存在cookie,但执行此操作的代码行引发以下异常:uncaughttypeerror:Object function(e,t){return new b.fn.init(e,t,r)}没有方法“cookie”

我的问题:检查jQuery移动应用程序中是否存在cookie的正确方法是什么,或者这在当前版本的jQuery移动应用程序中是不可能的?我正在Icenium开发混合移动应用程序

我使用的代码如下

function CallGetEmployees() {
    var serviceurl = "http://localhost:49441/WebService1.asmx/GetEmployees";
    $.ajax({
        url: serviceurl,
        type: 'POST',
        async:true,
        cache:false,
        dataType:"json",
        beforeSend:  function(xhr, opts) {
            var formsCookie = $.cookie("cookie1");
            if (formsCookie == null) {
                xhr.abort();
                clearForm();
                setMode("login");
                $("#sessionEnded").html("Your session has ended. Please login again.");
                $("#sessionEnded").show();
            }
        }

您正在使用jQuery cookie插件吗?不是。我以为插件不是为移动混合应用程序设计的。不过,jQuery并没有随$.cookie一起推出。顺便说一句,既然你提到你正在做一个移动混合应用程序,你在用Phonegap吗?如果是这样,根据这个链接:你应该使用本地存储而不是cookies.Ok。我在用冰片,我明白了。尝试使用jQuery.cookie插件测试代码。