您可以尝试如下操作:
HTML:
jQuery的:
$(document).ready(function(){
$("#BtnId").on( 'click', function(){
$.ajax({
type : "POST",
url : "callsp.php",
success : function(text){
alert(text);
}
});
return false;
});
});
PHP: (callsp.php)
// connect to database
$connection = mysqli_connect("hostname", "username", "password", "db", "port");
// run the query
$result = mysqli_query($connection, "CALL DeleteRow") or die("Query Failed: " . mysqli_error());
// loop the result set
while( $row = mysqli_fetch_array($result) ) {
print_r( $row );
}
?>