0
モーダルウィンドウで動作するサブスクリプションフォームがありますが、ウィンドウを閉じてサブスクライブするボタンをクリックすると戻ると、エラーが発生します。モーダルを呼び出して閉じるために重複するajax
$("#openModal").click(function() {
if($("#wname").val() == '' || $("#lname").val() == '' || $("#wmail").val() == ''){
$('#message-error').html("Los campos no pueden estar vacios");
return;
}
$("#message").empty();
var regex = /^([\w-\.][email protected]([\w-]+\.)+[\w-]{2,4})?$/;
if (regex.test($('#wmail').val())) {
$('#myModal').modal('show');
$('#fin_coach_acept').click(function(event){
$('.whmessage').empty();
$('#message').empty();
datos['usu_nombre'] = $("#wname").val();
datos['usu_apellido'] = $("#lname").val();
datos['pa_id'] = 32;
datos['usu_fechanacimiento'] = '';
datos['sexo'] = $("#sexo_e").val();
datos['firma'] = '';
datos['mail'] = $("#wmail").val();
datos['intereses'] = '';
datos['rol_id'] = 2;
datos['pa_residencia'] = '';
datos['curso'] = $(".whcursos").val();
datos['contmin'] = $("#contmin").val();
datos['contper'] = $("#contper").val();
console.log(JSON.stringify(datos));
$.ajax({
type: "POST",
url: "<?php echo home_url(); ?>/wssetcoach.php",
data: {datosw: JSON.stringify(datos)},
success: function(res){
if(res == 'logrado'){
$("#message").append("<span style='color:#76292F;'>Usted ya se encuentra registrado como Facilitador con: "+ $("#wmail").val() + "</span>");
} else {
$('.whmessage').append("<p>¡Gracias por registrarte!. Desde ahora eres parte de ActiveMind. Se enviarán los datos de acceso al Sistema Académico a la cuenta de correo:</p><p>"+$("#wmail").val()+"</p><p>Cualquier consulta envía un correo electrónico a la dirección:</p><p>[email protected]</p>");
$('#final').modal('show');
$('#finalize').click(function(event){
$(location).attr('href', 'http://www.activemind.center/active/');
});
$('#myModal').modal('hide');
$('#final').modal('show');
$('#coach_cancel').click(function(event){
$('#facilitadorini').modal('hide');
$('#myModal').modal('show');
});
}
}
});
});
} else {
$('#message-error').html("El correo no es válido");
return;
}
});
どうやら、マナーをメモリに保持され、それを削除するには、次のコードを使用されてきたが、動作しません:$(「#のstudentini」)削除します();。
任意のアイデアソリューションは、私には有用であろう、おかげ