I run json_encode
PHP function and get following output:
[{"id":"1","size":"124","name":"Team1","picture":1},
{"id":"5","size":"76","name":"Team 4","picture":2},
{"id":"3","size":"25","name":"Team2","picture":3},
{"id":"4","size":"17","name":"Team3","picture":4}]
Now I want to parse it using JQUERY and add it to my web page. I run following script:
<script>
$(function() {
$('#myButton2').click(function(e) {
$.get("http://localhost:99/result/getBestOne", function(data) {
alert(data+"");
var obj = JSON.parse(data);
alert(obj+"");
});
});
});
</script>
My problem is that first alert is working, but in second one, I get error:**Ucought SyntaxError: Unexpected Token**
Where is the problem?