4
I need to redeem the input array value that the user clicks, these inputs are dynamic values.
HTML/PHP
<label>
<i class="fa fa-lg fa-times-circle"><input value="<?=$fs_value?>" name="valor" type="button" data-toggle="modal" data-target="#delSession"></i>
</label>
JS
var val = $("input[name=valor]").val();
$.ajax({
url:'delSession.php',
type:'GET',
data:'valor=' + val,
success:function(data){
$('.exibeDelSession').html(data);
}
});
return false;
In case I can not put the value of input name="value[]" because I can not rescue in the script and using so it brings me only the first value independent of which input click.
There will be several inputs with different values, wanted to pick by name or input clicked, something like this.
I stand by.
If you have more than one button how to know which one is right? It has more than one right button?
– rray
It is not clear where the "array" is. There would be several
<input name="valor">
, thus forming an array?– Daniel Omine
Ever tried to get by
id
?– Jeferson Assis
yes, there will be several Buttons. and the array would be <input name="value[]"> but I cannot capture that array in js.
– Bruno Depieri Barduchi
you will delete more than one thing per click?
– rray
by id not Jeferson but I wouldn’t have to assign a value to that id? id="1" and so on?
– Bruno Depieri Barduchi
rray, only one deletion per click
– Bruno Depieri Barduchi
Summon the ajax at the button click so you can identify who was clicked and get the correct value, since you are not using
ids
.– rray
Then rray a delSession.php I apply a var_dump($_REQUEST); and it always brings the first value only with the script q passed above, I need to get the other values.
– Bruno Depieri Barduchi