I'm iterating through an array of json data but need to remove the first element prior to the iteration. How do I remove the initial element? This is what I have so far:
$.post('player_data.php', {method: 'getplayers', params: $('#players_search_form').serialize()}, function(data) {
if (data.success) {
// How do I remove the first element ?
$.each(data.urls, function() {
...
});
}
}, "json");
Plain javascript will do:
data.urls.shift()
On shift()
method:
Removes the first element from an array and returns that element. This method changes the length of the array.
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With