jquery, javascript - how to remove this parameter from variable
I have some coding and already pushed this into a variable. I would like to remove it and reinsert another value. Please note that I am programming a lot of the coding with perl. I would like to remove menu_mode value. Any tips would be a great since javascript/jquery are a new language to me.
print qq|
\$("#extractparam").click(function () {
\$("#grapharea").html(" ");|;
foreach my $num (1 .. $count)
{
if ($num eq 1)
{
print STDOUT qq|var params = \$("#volt$num").serializeArray();|;
} else
{
print STDOUT qq|var volt$num = \$("#volt$num").serializeArray();|;
print STDOUT qq|params = \$.merge(params, volt$num);|;
}
}
print qq| params.push({ name: 'menu_mode', value: '3C-extractparameters' });
\$.get("./scripts/banana_extract.cgi", params, function(data){ \$("#paramselection").html(data) });
// would like to remove the menu_mode value
params.push({ name: 'menu_mode', value: '3D-extractparameters' });
\$.get("./scripts/banana_extract.cgi", params, function(data){ \$("#graphoptionselection").html(data) });
\$("#extractparam").removeAttr('sty开发者_运维百科le');
\$("#Execute_Button").css("background-color","lightblue");
});
If I understand your question correctly you want this:
params.pop();
That'll remove the last element from the array (the one you just pushed).
精彩评论