Iam using an wcf web service to retrieve value from database ,iam calling it from jquery ajax call,the problem is getPollDetails.ModelMake is null or not an object.
var varType;
var varUrl;
var varData;
var varContentType;
var varDataType;
var varProcessData;
//Generic function to call AXMX/WCF Service
function CallService() {
$.ajax({
type: varType, //GET or POST or PUT or DELETE verb
url: varUrl, // Location of the service
data: varData, //Data sent to server
contentType: varContentType, // content type sent to server
dataType: varDataType, //Expected data format from server
processdata: varProcessData, //True or False
success: function (msg) {//On Successfull service call
ServiceSucceeded(msg);
},
error: alert('not working')// When Service call fails
});
}
//Data Available
function ServiceSucceeded(result) {
$('span[id=lblmakemodels]').text(result.getPollDetails.ModelMake);-->when i keep break point on (result.getPollDetails.ModelMake) value is coming here also.
alert(result.getPollDetails.ModelMake);
}
function PollingDataJSON(selectdata) {
alert(selectdata);
varType = "POST";
varUrl = "../HttpHandler/GetPollingDataService.svc/getPollDetails";
varData = JSON.stringify({
vehicleno: selectdata,
});
varContentType = "application/json; charset=utf-8";
varDataType = "json";
varProcessData = true;
CallService();
}
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
[DataContract]
public class GetPollingDataService : IGetPollingDataService
{
[DataMember]
public string ModelMake;
when i keep the break point values is retreiving in objdet.ModelMake.