user3782984
user3782984

Reputation: 1

building an app with Phonegap,ajax and php

I want to build an app with php, ajax and phonegap via the following ways: All the client files in the app will be coded with ajax and html while the server side will be in php hosted online. My question is will php session works with phonegap and ajax since the client files will be on phone which makes connections call to php files on server. Will session works from one page to another

Upvotes: 0

Views: 1711

Answers (4)

Asa Carter
Asa Carter

Reputation: 2225

Yep, I'm using the jQuery Cookie function to store the PHPSESSID (or whatever), then if your PHP backend stores the session against the user you can do a request to get the user based on the session when the app loads and also send the session with each request.

You also need to enable CORS on the server for the AJAX requests (Much easier than jsonp).

You can also use Local Storage to store the session ID instead of using the cookie plugin.

Upvotes: 1

ITjc
ITjc

Reputation: 9

You can use jsonp in conjunction with HTML5, CSS, and AJAX to accomplish what I believe you are trying.

I used jQuery and am very happy with how our app is shaping up.

Upvotes: 0

Hanh Le
Hanh Le

Reputation: 894

Phonegap is framework to build cross app by JS + html + css. It working same the web app. It have more powerful ability to access to many native API: contact, device,.. then in web app haven't. Web app working in browser, Phonegap app(hybrid app) working in WebView(same browser + ability communication with native API - system(Android, IOS, ...)). Everything web app perform then Phonegap app can perform, session or anything.

Upvotes: 0

Kevin Damstra
Kevin Damstra

Reputation: 125

You can always use the HTML5 localstorage to store data. As far as I know you can't use cookies with Phonegap apps.

Upvotes: 0

Related Questions