Created
January 30, 2012 20:51
-
-
Save pierceray/1706611 to your computer and use it in GitHub Desktop.
Trying to log WCF service JSON to console.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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