Please help me, I can now deleted the data from my database but It will not automatically disappear in the screen
Here`s my code:
$(document).on('click','.remove',function(e){
var x = document.getElementsByTagName('input');
var a = $(this).attr('data');
$.ajax({
url:"http://localhost/scorecard/wp-
content/themes/twentyseventeen/ajax/submit.php?function=removeScore",
type:"post",
data:{ id:a },
success: function(data){
alert("Success");
$('#formUpdateScore').append(data);
}
});
})
This is my html:
<form id="formUpdateScore">
<?php
include(dirname(__FILE__).'/template-parts/php/add_variable.php');
$var = new variable();
$connection = $var->connect();
$var->gi_id = $_POST['id'];
$GLOBALS['x'] = $var->gi_id;
$query = "SELECT * FROM business_variable WHERE company_id = ".$var->gi_id;
$result = mysqli_query($connection,$query);
while($row = mysqli_fetch_array($result)){
?>
<div class="col-md-4 col-md-offset-1 aligntop">
<div class="varName">
<div class="col-md-8" style="padding:0;">
<span class="variable" name="<?php echo $row['variable_name']?>" value="<?php echo $row['var_id']?>"><?php echo $row['variable_name']?></span>
</div>
<div class="col-md-4" style="padding-left: 0;">
<input type="number" name="name[]" style="width: 55%;height: 40px;float: left;padding: 5px 4px;" class="score" id="getScore" data="<?php echo $row['var_id']?>" value="<?php echo $row['variable_score']?>"/>
<input type="button" data="<?php echo $row['var_id']?>" class="remove" value="-"/>
</div>
</div>
</div>
<?php
}
mysqli_close($connection); ?>
</form>