I have what I believe to be a valid json test but I cannot get it to function correctly.
Here is a fiddle: http://jsfiddle.net/pwwj4zf5/
Any ideas why the onReady
wouldn't be displaying the response in the Ajax call?
var a;
function fetch_data(){
$.ajax({
url: "http://echo.jsontest.com/key/value/one/two",
cache: false,
dataType: "json",
type: "GET",
data: {
//datapoint: '(' + response1.d.PointOfContactId + ')'
},
success:function(data){
return data;
}
});
}
$(document).ready(function(){
a = fetch_data();
console.log(typeof(a));
console.log(a);
});