Click here to Skip to main content
15,561,817 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to use ajax to call my web services. Already i have deployed my web-service in my virtual machine.


Try this URL with Rest client Jar

Method = GET
Key = accept
value = Application/json

**My Code below**

type: "GET", //GET or POST or PUT or DELETE verb
url: "", // Location of the service
data: "", //Data sent to server
contentType: "application/json", // content type sent to server
dataType: "json", //Expected data format from server
processdata: true, //True or False
success: function (data) {//On Successfull service call

var result =;
alert("result===" + result);
error: ServiceFailed// When Service call fails

return false;


But I am getting no response from the above code. Please help me out in this.

Regd's Karthick

do it on a test page first

step1: add web reference of ur service to ur project

step:2 in javascript page

function ()

var value = "2";
$.ajax (
type: "POST",
url: "Liveuse_oftemplate.aspx/MethodWithNumericParameter",
data: "{'strParam':" +value+",'secondparam':3}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function (msg)

error: function (x, e)
alert("The call to the server side failed. " + x.responseText);
return false;


step:3 in serveice

public static string MethodWithNumericParameter(string strParam, string secondparam)

return "Parameter sent to server from client side is " + strParam + " second param" + secondparam;
Share this answer
Karthick88it 20-Nov-12 2:17am    
After trying out this i am getting an error in my console as
ReferenceError: json is not defined
var result =;

Any idea on this
NAPorwal(8015059) 21-Nov-12 1:29am    
Have u solved ur problem?
NAPorwal(8015059) 21-Nov-12 4:49am    
kartick, do u want to retrieve name from json using ?
var result =;

then do it like


first alert data value and see if it is working then retrieve value and don't forget to put reference of jquery.json-2.2.min.js in ur head tag
u can download it from
Nellam Chandra

No, I have tried at my end but getting error due to cross domain call error. Any idea about this

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900