I'm trying to dynamically change a modal's content with the result of a query using PHP.
So far, I've managed to reach the ajax call, but I'm not getting a success nor error message
PHP: get_user.php
<?php
include ("session-connection.php");
session_start();
$result = $_POST['param'];
echo $result;
?>
HTML
<script type="text/javascript">
function view_progress(row){
console.log("id: " + row);
var param = row;
$.ajax({
data: param,
url: 'get_user.php',
type: 'post',
beforeSend: function(){
$("#progressModal").modal('show');
$("#alert_name").html("...");
},
error: function (){
$("#alert_name").html("Error");
},
success: function(resultado){
$("#alert_name").html(resultado);
}
});
}
</script>
If the code is successfull it should change the label alert_name with the id the javascript function recieves.
Aucun commentaire:
Enregistrer un commentaire