81 lines
2.8 KiB
PHP
Executable File
81 lines
2.8 KiB
PHP
Executable File
<div class="tab-pane fade" id="others-tab">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card-body">
|
|
<form role="form" class="parsley-examples" method="post" id="others_form" enctype="multipart/form-data">
|
|
<input type="hidden" name="client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
|
|
|
<div class="form-group">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12">
|
|
<label for="addon_subheading">Addon Sub-Heading</label>
|
|
<textarea class="form-control" id="addon_subheading" name="addon_subheading" rows="1" placeholder="Enter Text"><?= isset($client['addon_subheading']) ? $client['addon_subheading'] : '' ?></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group text-right m-b-0">
|
|
<button type="submit" class="btn btn-primary" id="others_form_submit">Submit</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div> <!-- end col-->
|
|
</div>
|
|
<!-- end row -->
|
|
</div>
|
|
|
|
<!-- end -->
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
|
|
//for Client Others Form Submit using AJAX
|
|
$("#others_form").submit(function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
var isValid = $('#others_form').parsley().validate();
|
|
if (!isValid) {
|
|
return;
|
|
}
|
|
|
|
if (isValid) {
|
|
|
|
$('.loader').fadeIn();
|
|
$('.loader-mask').fadeIn();
|
|
|
|
var form_action = '<?= base_url("client/others/create"); ?>';
|
|
var formData = new FormData($('#others_form')[0]);
|
|
|
|
$.ajax({
|
|
data: formData,
|
|
url: form_action,
|
|
type: "POST",
|
|
dataType: 'json',
|
|
processData: false,
|
|
contentType: false,
|
|
success: function(res) {
|
|
console.log(res);
|
|
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
if (res.status == true) {
|
|
toastr.success(res.message, 'Success');
|
|
} else {
|
|
toastr.warning(res.message, 'Warning');
|
|
}
|
|
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
console.error(status, error);
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
console.log('Something Wrong!', 'warning');
|
|
}
|
|
});
|
|
|
|
}
|
|
});
|
|
|
|
});
|
|
</script>
|