简体   繁体   English

如何在Windows Phone的phonegap中设置cookie?

[英]How can I set cookies in phonegap for windows phone?

I want to store some data on server so that when I login again, server should remember me and retrieve my previous data. 我想在服务器上存储一些数据,以便当我再次登录时,服务器应该记住我并检索我以前的数据。

As of now as I'm not using any session management when I login with some username and send some message and all, it shows me some response and when I login with another username its showing me the same data of that previous user. 截至目前,当我使用某个用户名登录并发送所有消息时,我还没有使用任何会话管理,这显示了一些响应,而当我使用其他用户名登录时,它向我显示了与先前用户相同的数据。

So here is the problem of not maintaining session. 因此,这里是不维护会话的问题。

So please anyone tell me how can I maintain session with ajax JavaScript and jQuery. 因此,请任何人告诉我如何使用ajax JavaScript和jQuery维护会话。

I can't use any server side script as I'm working with visual studio express 2012 for windows phone. 我正在使用Visual Studio Express 2012 for Windows Phone时,不能使用任何服务器端脚本。

So guide me for session management or information about cookie in phonegap app. 因此,指导我进行会话管理或有关phonegap应用程序中cookie的信息。

1. for storing 1.存放

localStorage.setItem("username", "Smith");

for getting 为了得到

localStorage.getItem("username");// here returns smith

ref 参考

2 . 2。 second option use mobile database 第二种选择使用移动数据库

Refer this example 参考这个例子

3 . 3。 use cookies ref here for example of and plugins 在此处使用Cookie ref作为和插件的示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM