Skip to content

Instantly share code, notes, and snippets.

@pierceray
Created January 30, 2012 20:51
Show Gist options
  • Save pierceray/1706611 to your computer and use it in GitHub Desktop.
Save pierceray/1706611 to your computer and use it in GitHub Desktop.
Trying to log WCF service JSON to console.log
$(document).ready(function () {
$.ajaxSetup({
type: "POST",
contentType: "application/json; charset=utf-8",
data:"{}",
dataFilter: function(data) {
var msg;
if (typeof (JSON) !== 'undefined' && typeof (JSON.parse) === 'function')
msg = JSON.parse(data);
else
msg = eval('(' + data + ')');
if (msg.hasOwnProperty('d'))
return msg.d;
else
return msg;
}
});
var geoRequest = {
"geoRequest": {
"counties": ["Travis"],
"latitude1":0.0,
"latitute2":0.0,
"layers":null,
"longitude1":0.0,
"longitude2":0.0,
"zipCode":null
}
};
var dataToSend = JSON.stringify(geoRequest);
$.ajax({
url: "http://theserver/GeoLocationService/GeoLocationService.svc/find",
data: dataToSend,
dataType: "json",
success: function(data){
console.log(data); //keep getting null, but the post is actually returning
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment