Bootstrap Toggle switch Update Database field using Ajax

Bootstrap Toggle switch Update Database field using Ajax

Welcome to the In pakainfo.com website! You will Step By Step learn web programming, easy and very fun. This website allmost provides you with a complete web programming tutorial presented in an easy-to-follow manner. Each web programming tutorial has all the practical examples with web programming script and screenshots available.For Bootstrap Toggle switch Update Database field using Ajax

Simple in this post explain to the Store Value from closed/open Button in onchange or clicked to MySQL Database store Using PHP Ajax dynemically. and Selected value each checkbox either it may be closed/open, it will be all the status stored in database.(Like as a mysql database)

Include Libs with jquery for toggle switch with ajax update to mysql

First of all the simple include the script in header part.


Page Name : index.html for toggle switch with ajax update to mysql

display all the dynemically response_result print here in this page using php with html.

Invoice ID Invoice Name Invoice Title Invoice Keywods Invoice Desc Action Status

Script.js for toggle switch with ajax update to mysql

simple request this page and all the response_result get and change to dynemically data result_data and show open or closed.


do_action.php for toggle switch with ajax update to mysql

update the value and status in call this file to database query executes.

 $response_result='Hey my button is open!!';
$success='Open';
echo json_encode(array('response_result'=>$response_result,'$success'=>$success));
}

else if ($mode=='false')
{
$str=$db->query("update invoice SET status=0 where productid=$productid");
$response_result='Hey my button is closed!!';
$success='Closed';
echo json_encode(array('response_result'=>$response_result,'success'=>$success));

}
?>

Example

toggle switch with ajax update | Save Bootstrap Toggle checkbox to database without postback using AJAX
| bootstrap toggle button | store value from on/off button in mysql database using php ajax

Leave a Comment