I am using this script which reads some internal json data.
The data is currently in the actual page.
I need to change the code to use getJSON? so that it reads the json from an external page/url
Here is the current full code:
<script>
var data = [{"id": "1","title": "mytitle"}];
var output = '';
$.each(data, function(index, value){
output += '<li data-icon="false"><a href="#">' + value.title + '</a></li>';
});
$('#listview').append(output).listview('refresh');
</script>
How do I change the code so I can use external json code instead of this way for example adding getJSON to it?
But if you’re trying to get data from different domain then you need something following:
Read more about .getJSON().