I have a ajax fucntion that gets a json array from the php , 8 numbers formed like this ["0","0","0","0","0","0","0","1"] , As I get this in a var called data , data[0] and this kind doesen't work , how can I access this numbers ?
kshahnazari
0
Newbie Poster
Recommended Answers
Jump to PostTry something like this...
<script> $.ajax({ dataType: "json", url: "getJson.php", success: function (data) { for (var index = 0; index < data.length; index++) { console.log(data[index]); } } }); </script>
You can see the results using your browser's dev tools, console.
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.