/**
- ajaxSubmit() provides a mechanism for immediately submitting
- an HTML form using AJAX.
- /
options = $.extend(true, { url: url, success: $.ajaxSettings.success, type: method || 'GET', iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' }, options);
submitHandler: function(form) { //Your code for AJAX starts jQuery.ajax({ url:'ajax.php', type: "post", data: $(form).serialize(), success: function(){ //alert("success"); $("#result").html('Submitted successfully'); }, error:function(){ // alert("failure"); $("#result").html('There is error while submit'); } //Your code for AJAX Ends });
sur la même page entamer mon traitement des informations en pur php?
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionsubmitHandler: function(form) {
$.ajax({
url: 'ajax.php',
type: 'POST',
data: $("#signupForm").serialize()
});
},
$.ajax({ url: 'ajax.php', type: 'POST', data: $("#signupForm").serialize() , success : function(response, statut){ // success est toujours en place, bien sûr ! console.log( response); }, error : function(resultat, statut, erreur){ console.log( 'ERREUR AJAX',resultat,erreur); } });
$dsn = 'mysql:host=mysql.....perso;dbname=...........';
$user = '..........';
$password = '.........';
try {
$dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
echo 'Connexion échouée : ' . $e->getMessage();
}
$statut= htmlentities($_POST['statut']);
$pseudo = htmlentities($_POST['last_name']);
$nom_ste= htmlentities($_POST['nom_ste']);
$mail= htmlentities($_POST['email']);
$siret= htmlentities($_POST['siret']);
$phone = htmlentities($_POST['phone']);
$password= htmlentities($_POST['passw1']);
$date = date("d-m-Y"); $heure = date("H:i");
$ip = $_SERVER['REMOTE_ADDR'];
$dbh->exec("INSERT INTO TABLE (pseudo,mail,m2p,phone,statut,nom_ste,siret,ip,date,heure) VALUES('$pseudo','$mail','$password','$phone','$statut','$nom_ste','$siret','$ip','$date','$heure')");