Call Web service in java script

Posted by Kkdubey under JavaScript on 5/11/2012 | Points: 10 | Views : 2713 | Status : [Member] | Replies : 7
how can i call web service in java script....and also how can i return dataset from web service or wcf service to javascript ?
someone give me any idea about that.....

Thanks
Krishna




Responses

Posted by: Sakthi.Singaravel on: 5/11/2012 [Member] Silver | Points: 25

Up
0
Down
Refer this..

http://www.hendricksongroup.com/code_call_web_service_javascript.aspx

Regards,
Singaravel M

Kkdubey, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 5/12/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
refer this link.
http://www.codeproject.com/Articles/14610/Calling-Web-Services-from-HTML-Pages-using-JavaScr

Thanks & Regards
Hari

Kkdubey, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kkdubey on: 5/14/2012 [Member] Starter | Points: 25

Up
0
Down
Thanks Hariinakoti,

I seen this link and i tried the same procedure but, i am not able find method (Service.useService).
so,you have any idea how can i find and use this method(useService).
and i write forcefully this method in java script then i could not call web service.

Thanks
Krishna

Kkdubey, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 5/14/2012 [Member] Starter | Points: 25

Up
0
Down
Sorry Krishna i dnt knw.Thats why i posted this link....
Wait & see our DSP team will help u...

Thanks & Regards
Hari

Kkdubey, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kkdubey on: 5/14/2012 [Member] Starter | Points: 25

Up
0
Down
Thanks.....

Kkdubey, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ajay.Kalol on: 6/5/2012 [Member] Starter | Points: 25
Posted by: Svandanapu on: 6/5/2012 [Member] Starter | Points: 25

Up
0
Down
You can call thr Ajax request from Javascript as below
var webMethod = '...<Path> / <ServiceName>.asmx/<WebMethod>';
var parameters = "{'userID' : '" + UserID + "','prsnID' : '" + PersonID "'}";

$.ajax({
type: "POST",
url: webMethod,
data: parameters,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
// Do whatever you want
error: function (msg) {
// Handle your error
}
});


Note :- You have to ensure, all the variable names and types must be same as your web method

Kkdubey, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response