Skip to content

Instantly share code, notes, and snippets.

@craveytrain
Forked from pierceray/geo.js
Created January 30, 2012 21:04
Show Gist options
  • Save craveytrain/1706695 to your computer and use it in GitHub Desktop.
Save craveytrain/1706695 to your computer and use it in GitHub Desktop.
dataFilter method
$(document).ready(function () {
$.ajaxSetup({
type: "POST",
contentType: "application/json; charset=utf-8",
data:"{}",
dataFilter: function(data) {
var msg = jQuery.parseJSON(data);
return (msg.hasOwnProperty('d')) ? msg.d : 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,
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