asp.net - Converting AJAX REST call to a C# .NET -


i have ajax call works @ local server. i'm trying make same call via c# (from application/domain) i'am confused.

this webmethod:

[webmethod(true)] public static object parentlogin(string email, string password) {     list<object> childrenlist = new list<object>();      usuario loggeduser = getbyemailandpass(email, password);     if (loggeduser != null)     {         var children = factory.current.getinstance<ichildrenbiz>().getall().tolist();          foreach (var item in children )         {             childrenlist.add(new { userid = item.id, name = item.nome });         }         return new { success = true, email = loggeduser.login, users = childrenlist};     }      return new { success = false }; } 

this ajax call:

var url = "http://localhost/" + "logintest/login.aspx/parentlogin";     var dataparams = "{ email: " + "'myemail@hotmail.com'" + ", password: " + "'123123'" + " }";      executeajaxcall(url, dataparams, true, function (msg) {         if (msg.d) {             var success = msg.d.success;              var children = msg.d.users;              if (children.length > 0) {                 $.each(children, function (i, item) {                     if (item) {                          var childid = item.userid;                     }                 });             }         }      }, standarderror);  }); 

now want call same webthod via code behind. tried usind restsharper, couldn't make happen. anyone, please?

edit:

this executeajaxcall method:

function executeajaxcall(url, dataparam, isassync, callbacksucess, callbackerror) { $.ajax({     type: "post",     url: url,     data: dataparam,     contenttype: "application/json; charset=utf-8",     datatype: "json",     assync: isassync,     success: function (msg) {         callbacksucess(msg);     },     error: function (msg) {         callbackerror(error_msg);     } }); } 

important:

the main reason want bacause want consume parentlogin method domain. maybe ios or android application! right approach?

thank you!

this web method (a "page method", actually), public static method within web application. should able call it:

namespace.login.parentlogin(email, password); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -