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.Code:$('#agOn').change(function() { var myswitch = $(this); var show = myswitch[0].selectedIndex == 1 ? true:false; $('#showInfo').toggle(show); $.ajax({ type: "POST", url: serviceURL + "submitdata.php", data: 'type='+'agentInfo'+'id='+'30'+'status='+agOn , cache: false, success: function(response){ //alert("Record successfully updated"); } }); });
Any help would be greatly appreciated. Thanks!


Reply With Quote

Bookmarks