Hello Friendz,
In this session I am insert the user with some kind of details and update the details.
now my problem is that, when I am change the Zone value then State and branch value removed same case for update case. please see the image for reference.(Getting all value as per zone in state and branch)
now what I need that,when I change the value of zone then textbox will reset with its value i.e. Select State and same for branch
while in update case need same.
my code as below
Script:-
$('#ddlZone').on('change', function () {
var ZoneCode = $('#ddlZone option:selected').val();
debugger;
fillState(ZoneCode, -1);
});
// On State change event Branch Append
$('#ddlState').on('change', function () {
var StateCode = $('#ddlState option:selected').val();
debugger;
fillBranch(StateCode, -1);
});
function fillState(ZoneCode, StateCode) {
$('#ddlBranch option').remove;
$.ajax({
type: 'GET',
data: { ZoneCode: ZoneCode },
url: "/Admin/loadStates",
success: function (result) {
var s = ' ';
for (var i = 0; i < result.length; i++) {
s += '';
}
//if (StateCode.toString() != "0")
$('#ddlState').html(s);
$('#ddlState').val(StateCode);
}
});
}
function fillBranch(StateCode, BranchCode) {
$.ajax({
type: 'GET',
data: { StateCode: StateCode },
url: "/Admin/loadBranch",
success: function (result) {
var s = ' ';
for (var i = 0; i < result.length; i++) {
s += '';
}
$('#ddlBranch').html(s);
// if (BranchCode.toString() != "0")
$('#ddlBranch').val(BranchCode);
}
});
}
HTML code:-
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
sukesh gandhamPosted Jun 7, 2018, 4:41 AM
Prakash PrajapatiPosted May 22, 2018, 6:58 AM