Mehmet
Mehmet

Reputation: 1874

Mobile Web Application with Web Service

I want to write a mobile web applicaiton with jquery mobile and html5. Is it possible to call an asp.net web service with jquery ajax function for mobile web applcaiton.. Is there any sample for this? And asp.net web forms or asp.net mvc which one should I choose for mobile web application?

Upvotes: 0

Views: 555

Answers (1)

Apostolos Emmanouilidis
Apostolos Emmanouilidis

Reputation: 7197

Of course it is possible to consume an ASP.NET web service.

Check the PhoneGap mobile platform. PhoneGap is an open source framework for quickly building cross-platform mobile apps using HTML5, Javascript and CSS.

I propose to implement a JSON web service.

Sample Example:

$.ajax({
    type: "POST",
    url: 'http://.../.../Test.asmx/WSMethod',
    data: 'parameter1=' + param1 + '&parameter2=' + param2,
    dataType: "json",
    success: function(data) {    
        // do something
    },
    error: function(err){
        // do something              
    }
});

The above example posts two parameters, the parameter1 and parameter2.

In case you don't want to post any parameters use: data: ''

Upvotes: 1

Related Questions