When I use the jQuery library to load an array and get its length using my own javascript, it just splashes out the total number of bytes of the array, for example:
$.get({
url: 'https://rawgit.com/tvman-123/shrek/master/ExampleOutputForSubscription_Post.php',
data: {},
success: function(data) {
ParseData(data);
}
});
function ParseData(data) {
console.log(data.length)
}
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
Run codeHide resultBut when I turn on the inline array, it works as expected, like so:
data=["UU9CuvdOVfMPvKCiwdGKL3cQ","UUrTNhL_yO3tPTdQ5XgmmWjA","UUz-RZblnhjXK_krP1jDybeQ","UUc_xdkOBgSYLmXTn-VSQ4uA","UUmb8hO2ilV9vRa8cilis88A","UU45SDrjKlPSY0bTvH6F7TOA","UUdGkmb5zEDXnPSmQlV43t0Q","UUpeGBKn0axOJAcPHkcPiXcg",""]
ParseData(data)
function ParseData(data){
console.log(data.length)
}
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
Run codeHide resultI understand that the first one is an array of bytes, and the second is an arraylist.
Can someone explain to me why this is done and how to fix it ???
EDIT:
Thanks to everyone for your answers and helped me solve this problem.
source
share