Echo dupa Ajax Request
Scris: Mie Iul 31, 2019
Salutare ,
Cu toate ca am citit documentatia,nu reusesc ca fac un 'echo' dupa ce am trimis datele prin ajax, are cineva idee, de ce nu merge ?
Cod:
Cu toate ca am citit documentatia,nu reusesc ca fac un 'echo' dupa ce am trimis datele prin ajax, are cineva idee, de ce nu merge ?
Cod:
Cod: Selectaţi tot
<?php
echo "before if";
// delete part
if (isset($_POST['delete'])) {
echo "after if";
$f_api = false ; //test
if ($f_api) {
echo " If Statment";
} else {
echo '<script type="text/javascript"> alert("Else Statment !");</script>';
}
?>
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
<input type="button" class="btn btn-danger remove" value="DELETE" style="width:120px !important"><br>
<script>
jQuery(".remove").click(function() {
if (confirm("Do you need to delete ?")) {
jQuery.ajax ({
type:'POST',
data: {id:'1234', elementus:'delete'},
success: function(data) {
window.location.href = window.location.href;
} }); } });
</script>