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!
This may be zero, which causes an error with an empty($_POST["agOn"]) ? Then an isset() would be better ?
In any case, check the POST variables (with a line foreach ($ POST as $ k => $ v) echo "$k => $v<br>";) in the file submitdata.php and an alert(response.responseText) in the callback function)
Last edited by 007Julien; 11-27-2012 at 07:28 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread