i'm developing a chat using php, bootbox and ajax to submit form, right, but i can't submit form with ajax!
$(document).ready(function(){
$("#startchat").click(function(){
bootbox.confirm("<center><form id='infos' method='POST' action=''>\
<p style='font-size:25px'>Formulário para Inicialização do Chat</p>\
Nome: <input type='text' name='nome'></input><br/><br/>\
Email: <input type='text' name='email'></input>\
</form></center>", function(result) {
if(result){
$('#infos').submit();
$.ajax({
type: 'post',
url: 'dateRecd.php',
data: 'nome=' + nome + '&email=' + email,
success: function(data){
alert(nome+' e '+email);
}
});
}
});
});
});
Well, i need submit form to the next page dateRecd.php insert date and call this chat function chatWith(id,name) with two parameters, that start the chat, Id and Name, they are fetched data in mySQL!
I don't where is wrong, firt time i'm using bootbox
<a href="javascript:void()" id="startchat">
<img src="banner.jpg">
</a>