How to "login" when use Sencha-Touch + phoneGap?
I have some confrustion when I dev a web app with Sencha-Touch and phoneGap.
1. Does it means we must use JSON-P instead of JSON?
(because it is a app, so it has the cross-domain problem)
2. What is the best approach if the server is RESTful(request and get JSON response)?
I saw we need rewrite some server code(such as add "callback" param) if use JSON-P.
3. How to manage auth such as login function?
how does the session/cookie works in this app?
Is there any example?
Hi, you can use json, no need to use jsonp. When you package an app with Phonegap there is no cross domain problem because you haven't a "starting url". I suggest to use server side session variable, is what i do. Once you login you can check the validity of the session variable at every ajax call. If you dont have ajax call after login just check the validity of session variable at regular interval (setInterval) with a an ajax call to the server.
I am also facing same problem
I am facing same cross domain ajax problem.
When I am sending a ajax request to a server after package up the app with phone gap
But no response returns.
Ext.Ajax.reqeust() ..restricted to do cross domain communication...So use JSONP or JSON but not Ajax.request()
Tags for this Thread