Currently, I have a url which renders data in json format.
url:
http://10.0.1.11/render?target=threshold(400,test)&from=-1mins&format=json&jsonp=?
when run in a browser gives me
?([{"target": "test", "datapoints": [[400, 1388755180], [400, 1388755190], [400, 1388755200], [400, 1388755210], [400, 1388755220], [400, 1388755230], [400, 1388755240]]}])
I would need the json result in a variable for further processing. I tried the following
foo
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
$.getJSON("http://10.0.1.11/render?target=threshold(400,test)&from=-1mins&format=json&jsonp=?", function(result){
//response data are now in the result variable
alert(result);
});
</script>
I ideally would need:
var test = [{"target": "test", "datapoints": [[400, 1388755180], [400, 1388755190], [400, 1388755200], [400, 1388755210], [400, 1388755220], [400, 1388755230], [400, 1388755240]]}];
Where am i going wrong?