none
WCF Rest Service Call in Ajax

    Question

  • Hi,

    I am calling the rest service in ajax(below code is how I call) .The URL is working fine in browser .I am getting the response.

    If I call the url in ajax unable to get the response in the success of ajax but I get the response in firebug in mozilla firefox.

    functioncalldp() {

     var action = 'GreenViewService.svc/GetDataPointValue/';

    $.ajax({"type": "POST",

    "url": action, 
     "data": JSON.stringify({ "dataPointId": RTWidget.RTDataPoint}),
     "contentType": "application/json",
     "cache": false,
    "dataType": "json",
    success:alert(result); 
    var json =eval(result.getdatapointvalueresult);
    alert(json);  
    varjson =eval(result);
    alert(json);
    function(result) {

    },

     "error":function(res){

    }

    });

    }

    Friday, April 22, 2011 6:47 AM