corrade-http-templates
/groupChat/groupChat.html |
@@ -20,7 +20,7 @@ |
|
<body> |
<div class="container"> |
<form role="form"> |
<form role="form" data-toggle="validator"> |
<div class="form-group"> |
<textarea class="form-control" id="chat" readonly="readonly" rows="12"></textarea> |
</div> |
@@ -27,11 +27,11 @@ |
<div class="form-group"> |
<div id="controls"> |
<div class="input-group"> |
<input class="form-control" id="name" maxlength="8" type="text" value="Someone"> |
<input class="form-control" id="name" maxlength="8" type="text" value="Someone" required> |
<span class="input-group-addon">@</span> |
<input class="form-control" id="message" type="text"> |
<input class="form-control" id="message" type="text" required> |
<span class="input-group-btn"> |
<button class="btn btn-default" id="send" type="button">Send</button> |
<button class="btn btn-default" id="send" type="submit">Send</button> |
</span> |
</div> |
</div> |
@@ -39,14 +39,13 @@ |
</form> |
</div> |
|
<script type="text/javascript" src="bower_components//jquery/dist/jquery.min.js"></script> |
<script type="text/javascript"> |
<!-- Include jQuery --> |
<script src="bower_components//jquery/dist/jquery.min.js"></script> |
<!-- Include Bootstrap Validator --> |
<script src="bower_components/bootstrap-validator/js/validator.js"></script> |
<script> |
$(document).ready(function () { |
function sendGroupMessage() { |
// Do not send the message if either the name or the message is empty. |
// This check is performed in the PHP script as well. |
if($.trim($("#name").val()) == '' || $.trim($('#message').val()) == '') |
return; |
// Hide the controls. |
$("#controls").animate({ opacity: 'hide' }, 'slow'); |
// Make the POST request to the PHP script and pass the values of the fields. |