i'm developing a chat and i want that the clients click on the button "Click here and start ur chat" and will open the form and after submit form "Start Chat"...
But i can't submit using ajax, i checked the console log, nothing appears strange!
<!DOCTYPE html>
<html>
<head>
<title>Start Chat</title>
<meta charset="utf-8">
<link type="text/css" rel="stylesheet" media="all" href="css/chat.css" />
<link type="text/css" rel="stylesheet" media="all" href="css/bootstrap.css" />
</head>
<body>
<center>
<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Click here and start ur chat
</button>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Write ur info below</h4>
</div>
<div class="modal-body">
<form action="" method="POST" id="form">
<table width="100%">
<tr>
<td>Name: </td> <td><input type="text" name="name" placeholder="Name"></td>
</tr>
<th> </th>
<tr>
<td>Mail: </td> <td><input type="text" name="mail" placeholder="Mail"></td>
</tr>
</table>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="start">Start Chat</button>
</div>
</div>
</div>
</div>
<!-- javascript:chatWith('3','Ronaldo') -->
</center>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/chat.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#start").click(function(){
$("#form").submit(function(e){
$.ajax({
url: "dateRecd.php",
type: "POST",
data: $(this).serialize(),
success: function(data){
alert(data);
// chatWith('9','name');
}
});
});
});
});
</script>
</body>
</html>