jquery is loading perfectly but json data is not loaded.I am not getting any error also.
script is
$("#loadjson").click(function(){
$.getJSON('filename.json', function(data) {
var items = [];
$.each(data, function(key, val) {
items.push('<li id="' + key + '">' + val + '</li>');
});
$('<ul/>', {
'class': 'my-new-list',
html: items.join('')
}).appendTo('body');
});
});
json file is
{
"name": "samsung",
"product": "led tv",
"rate": "23,000"
}
template is
<head>
<ul></ul>
<button>loadjson</button>
{% block js-custom %}
{% load static %}
<script src="{{ STATIC_URL }}scripts/jquery-1.9.1.min.js"></script>
<script src="{{ STATIC_URL }}scripts/modernizr-2.0.6.min.js"></script>
<script src="{{ STATIC_URL }}scripts/myscript.js"></script>
{% endblock %}
</head>
This is to display the name,product and rate in the screen.
Script is loading properlly,i am not getting error msg also.Nut i am not getting the o/p.What i thought was jon file is not loading.Please help me in doing this.
Guide me if any changes have to made to work this code.