Hi Can anyone help me with loading json into jquery I can only seem to get it to work in this structor
{
“name”: “Zemi All”,
“smpx” : “2564”,
“scuser”: “zajihi”,
“scfollowers”: “female”
}
This is the format page I have – http://newmusicproducer.com/filterable/indexj.php
My code below is:
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#driver").click(function(event){
$.getJSON('test.json', function(data) {
$.each(data.results,function(){
$('#stage').html('<p> Name: ' + data.name + '</p>');
$('#stage').append('<p> Smpx : ' + data.smpx+ '</p>');
$('#stage').append('<p> Scuser: ' + data.scuser+ '</p>');
$('#stage').append('<p> Scfollowers: ' + data.scfollowers+ '</p>');
});
});
});
});
</script>
</head>
<body>
<p>Click on the button to load results:</p>
<div id="stage" style="background-color:blue;">
Display area.
</div>
<input type="button" id="driver" value="Load Data" />
</body>
You are iterating over
data.resultsbut the link you provided shows that the array is calledtestData.