I am trying to parse a json file using jquery but im not getting any data back,
My jquery code:
$(document).ready(function () {
$.ajax({
type: 'GET',
url: 'http://anteatercycles.co.uk/xml/sensa.json',
success: function (json) {
var data1 = json.data[0];
var result1 = '<h3>' + data1.merchant_category + '</h3>' + '<p>' + data1.description + '</p>' ;
$('#description1').append(result1);
}
});
});
<div id="description1"></div>
Thanks in advanced.
edit to below still not retrieving any data?
$(document).ready(function () {
$.ajax({ type: 'GET', dataType: "json", url: 'http://anteatercycles.co.uk/xml/sensa.json', success: function (json) { json=JSON.parse(json);//parse json data var data1 = json.data[0]; var result1 = '
' + data1.merchant_category + '
' + '' + data1.description + '
' ; $('#description1').append(result1); } }); });</script>
<div id="description1"></div>