I am working with Android 2.2. I currently have the application wrapped in phonegap with Sencha. I have forms that use an Ajax request to post the information and send it to an email. It all works fine before I wrap it in Phonegap. I have read that you cannot do Ajax requests through phonegap though. Is there any way I can get this to work?
You can do AJAX requests through a Phonegap app. I have an app running on both Android and iPhone and it works fine for both local (in app) and remote (mobile to server) communications. I use jQuery, but I don't suspect that what library I use matters.
Related
I am making an desktop javafx application for school which work online server communication via json and php. I want to send a image file taken form java application to php server
You can make use of a http library like unirest to make your http request. sending images will be in the form
Unirest.post('URL_TO_POST_TO')
.header("accept", "application/json")
.field("image", new File(pathToImage))
.asJson();
My question is, how can I send a data (for example a text box) from a web mobile app (cordova) to my own server and save that data in server?
I tried post method but I couldn't run it completely.
You have to use AJAX request to make post requests to the PHP server.
You can find a documentation Ajax request using pure Javascript here.
Or using Jquery Ajax API
Watch out for CROS and Acces Control if you are not in localhost.
We have to develop an application with more plattform. We would use the framework PhoneGap. For our application we need services of backend, the question is: Does PhoneGap support PHP?
If it doesn't support PHP. In which way we can solve the problem?
The most important thing is: make call server
(Get and Post), parsing a json and other functions
that PHP gives.
Phonegap does not have a server. You need to call via Ajax to remote servers.
The backend can be in any language which supports HTTP calls, as PhoneGap is an independent client.
You can use PHP to write an API for use within your Javascript PhoneGap application.
I can recommend the Laravel framework to accomplish this.
Yes...you can use PHP or any PHP framework to give backend for mobile app made using phonegap/cordova....point is phonegap/cordova app will be on client mobile which won't understand PHP embedded in phonegap html files....so write an API amd place it on a server and then make AJAX calls to server to do database and other backed operations
Try to return JSON data from the PHP API.....it's a famous data structure and supported by many applications
I am trying to write a Sencha Touch application that I can package in PhoneGap for iOS, Android etc...
The app allows you to input some data which I would like to save to my backend server using PHP/MySQL. It all works when I use an AJAX proxy as I am testing the app on the same server as my database.
However when I package it for mobile devices I run into the same-domain restrictions of AJAX calls. So I modified it to use the JSONP proxy and I can read the data from the server database but have no idea how to write records back. Do I need to somehow pass the data in the GET request? Obviously the server side PHP needs to be different because of the callbacks and the fact JSONP is forced to used GET requests. I am also trying to get CORS working but currently no success.
So my question is how would I implement writing data back to my backend server from a packaged mobile Sencha app running on a mobile device? Either using JSONP if that is even possible or any other alternatives are welcome?
Many Thanks…
Is there a way of making this app: www.benjaminpotter.org/myarden
which uses php, mysql, html, css, javascript and jquery into a phonegap app?
Otherwise how would you make this an ipad app?
As far as I know, phonegap can not run PHP, cause it needs a server, it can use only HTML and JS which runs on the client.
You could make an empty iPad app with a Web Container for this URL, or make the provided site an WebApp (specific meta tags for the iOS).