php - JQuery .get not working on my page -
i dont understand why code doesnt work :
$( "#remove" ).click(function() { var getcontent = $("#noticeid").val(); $.get("admincp.php", { removeid : getcontent } ,function(){ }); });
heres html textbox :
<td><input class='form-control' style='position:absolute;left:500%;' type='text' name='noticeid' value='$editid'></td>
and button
<input type='button' id='remove' value='remove' class='btn btn-danger'>
and heres php (on same page):
if($_get['removeid']){ $removeid = $_get['removeid']; $querydelete = "delete `$dbtable`.`notices` `noticeid` = $removeid"; mysqli_query($conn,$querydelete); }
this worked simple php , html must script. sorry if simple mistake cant seem fix it.
edit:
putting input in if clause wasnt working fixed still doesnt work, here new html code ($info7 = notice id ):
<input id='noticeid' class='form-control' style='position:absolute;left:500%;' type='text' name='myname' value='$info7'>
you trying dom element id, name
set in html:
<td><input class='form-control' style='position:absolute;left:500%;' type='text' name='noticeid' value='$editid'></td>
you should add id, e.g.:
<td><input id='noticeid' class='form-control' style='position:absolute;left:500%;' type='text' name='noticeid' value='$editid'></td>
and able do:
var getcontent = $("#noticeid").val();
Comments
Post a Comment