<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/css/bootstrap-select.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/js/bootstrap-select.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="card-block">
<table class="table">
<tr>
<td>
<select name="paymentmethodparent" id="paymentmethodparent" class="selectpicker form-control" data-live-search="true">
<option data-tokens="" value="">Select a Method</option>
<option data-tokens="bank" value="bankchooser">Bank</option>
<option data-tokens="bkash" value="bkashchooser">bKash</option>
<option data-tokens="rocket" value="rocketchooser">Rocket</option>
</select>
</td>
</tr>
</table>
</div>
</div>
</div>
</body>
</html>
$(function() {
$('#paymentmethodparent').change(function(){
$('.paymentmethod').hide();
$('.' + $(this).val()).show();
});
});
$(function() {
$('#bankparent').change(function(){
$('.bankmethod').hide();
$('.' + $(this).val()).show();
});
});
$('#update').click(function(event) {
var paymentmethodparent = $('#paymentmethodparent').val();
//for banks dbbl and rocket
if (paymentmethodparent=='bankchooser')
{
var bankparent = $('#bankparent').val();
//for dbbl bank
if (bankparent=='dbbloptions')
{
var paymentmethod = 'bank';
var dbbl_holder = $('#dbbl_holder').val();
var dbbl_no = $('#dbbl_no').val();
var dbbl_branch = $('#dbbl_branch').val();
$.ajax({
type: "POST",
url: 'acc',
data: {
paymentmethod : paymentmethod,
bank_name:"dbbl",
dbbl_holder : dbbl_holder,
dbbl_no : dbbl_no,
dbbl_branch:dbbl_branch,
"_token": "{{ csrf_token() }}"
},
success: function(data){
console.log(data)
}
});
}//for brac bank
if (bankparent=='bracoptions')
{
var paymentmethod = 'bank';
var brac_holder = $('#brac_holder').val();
var brac_no = $('#brac_no').val();
var brac_branch = $('#brac_branch').val();
$.ajax({
type: "POST",
url: 'acc',
data: {
paymentmethod : paymentmethod,
bank_name:"brac",
brac_holder : brac_holder,
brac_no : brac_no,
brac_branch:brac_branch,
"_token": "{{ csrf_token() }}"
},
success: function(data){
console.log(data)
}
});
}//for other banks
if (bankparent=='otheroptions')
{
var paymentmethod = 'bank';
var other_bank_name = $('#o_bank_name').val();
var other_ac_holder = $('#o_account_holder').val();
var other_ac_no = $('#o_account_no').val();
var other_branch_name = $('#o_branch_name').val();
var other_routing_no = $('#o_rotuing_no').val();
$.ajax({
type: "POST",
url: 'acc',
data: {
paymentmethod : paymentmethod,
bank_name:'otherbank',
other_bank_name:other_bank_name,
bank_account_holder : other_ac_holder,
bank_account_no : other_ac_no,
branch_name:other_branch_name,
routing_no:other_routing_no,
"_token": "{{ csrf_token() }}"
},
success: function(data){
console.log(data)
}
});
}
}//for bkash
if (paymentmethodparent=='bkashchooser')
{
var paymentmethod = 'bkash'
var bkash_type = $('#bkash_type').val();
var bkash_no = $('#bkash_no').val();
$.ajax({
type: "POST",
url: 'acc',
data: {
paymentmethod : paymentmethod,
bkash_type : bkash_type,
bkash_no : bkash_no,
"_token": "{{ csrf_token() }}"
},
success: function(data){
console.log(data)
}
});
}//for rocket
if (paymentmethodparent=='rocketchooser')
{
var paymentmethod = 'rocket';
var rocket_type = $('#rocket_type').val();
var rocket_no = $('#rocket_no').val();
$.ajax({
type: "POST",
url: 'acc',
data: {
paymentmethod : paymentmethod,
rocket_type : rocket_type,
rocket_no : rocket_no,
"_token": "{{ csrf_token() }}"
},
success: function(data){
console.log(data)
}
});
}
});