I have 2 dropdowns 1.organization 2.bank names. I have multiple organizations and mulitple banks associated with it. if i choose org ABC it will display related banks list in banks dropdown.
Example: organization ABC have total 3 banks. 1.XYZ 2.PDF 3.OPQ
so onclick ABC it will display all 3 bank names in dropdown. but it shows XYZ bank as a default value. I want to change it.I want OPQ as a default bank of organization ABC. How to achieve this in jquery. i search alot but i dont understand because i dont have much knowledge in jquery.
Below is my ajax call to get particular organization's bank list.
$org_id = $_GET['orgId'];
$bank_id = $_GET['bankId'];
if( $org_id != '')
{
$bank_options = "";
$get_bank_names = "select * from bank_account_details where ORG_ID = '$org_id'
order by PRIORITY_SORT_ORDER";
$exec_bank_names = mysql_query($get_bank_names);
if(!$exec_bank_names)
{
die('Problem in selection'.mysql_error());
}
elseif( mysql_num_rows($exec_bank_names) > 0)
{
while( $row_bank_names = mysql_fetch_array($exec_bank_names))
{
$BANK_ACCOUNT_DETAILS_ID = $row_bank_names['BANK_ACCOUNT_DETAILS_ID'];
$BANK_NAME = $row_bank_names['BANK_NAME'];
if(($bank_id != '') && ($bank_id == $BANK_ACCOUNT_DETAILS_ID))
{
$bank_options .= "<option value= '$BANK_ACCOUNT_DETAILS_ID' >$BANK_NAME</option>";
}
else
{
$bank_options .= "<option value= '$BANK_ACCOUNT_DETAILS_ID' >$BANK_NAME</option>";
}
}
}
}
echo $bank_options;
I have one of organization whose $org_id is 40
and its $bank_id is 24
.