Here's my attempt at trying to remove a value from an array dynamically
$('.btn-remove').click(function() {
var players = ["compare","13076","13075","13077","12755"];
var removePlayer = $(this).data('player');
var idx = $.inArray(removePlayer, players);
if (idx != -1) {
players.splice(idx, 1);
}
window.location = "/" + players.join('/');
})
For example, $(this).data('player') could equal 13077 and i'd want it to remove that value from the array and then redirect to the url which is attached to the window.location variable
compare/13076/13075/12755?$(this).data('player')is auto-converted to a number, so the$.inArraytest fails comparing a number against a string.