jQuery Mobile with AJAX - Flip a toggle-switch and change a field in a MySQL Database
Ok, so I have a toggle-switch with the ID "agOn" and then I have a function to make a div show/hide when it's flipped... but I also want to change "agStatus" in my database to 1 or 0 when the toggle is flipped... so when the div is hidden, the database updates with agStatus = 0 and when the div is visible, the agStatus will be updated with agStatus = 1.
I've tested it and checked the database, but it's not getting updated... the part to toggle the div visibility is working fine, though.
var myswitch = $(this);
var show = myswitch.selectedIndex == 1 ? true:false;
url: serviceURL + "submitdata.php",
data: 'type='+'agentInfo'+'id='+'30'+'status='+agOn ,
//alert("Record successfully updated");
Any help would be greatly appreciated. Thanks!