nilesh wani
nilesh wani

Reputation: 1291

How to call web service in phonegap in android app?

I am beginner in phonegap. I have developed native apps in phonegap android. now this apps is only static, I want creat update button on my apps when i will clicked on update button then my webservice will called and this data stored locally in apps means in the local database.

Thanking you

Upvotes: 2

Views: 20065

Answers (3)

taruna-systematix
taruna-systematix

Reputation: 111

You can use the following lines of code to call the Web Service in PhoneGap:-

  $.post( url, { user_id:userID,password:password} , function( data ) {
                                                            if(data.status==true){

                                                                /*Your Code*/     
                                                            }else{
                                                                /*Your Code*/  

                                                            }
                                                          },"json");

Upvotes: 0

Suhas Gosavi
Suhas Gosavi

Reputation: 2170

A quick-and easy way is to call the service using AJAX, and you can use HTML5's localStorage to store the data.

Upvotes: 2

Clinton Ward
Clinton Ward

Reputation: 2511

A simple example that I personally like can be found here: http://coenraets.org/blog/2011/10/sample-application-with-jquery-mobile-and-phonegap/. It works with PHP / MySQL web server

Upvotes: 2

Related Questions