php - Sending an ajax request and updating a button status -


i have code button,

<table style='border:0;margin:0;padding:0;'><tr><td>"; echo "<form action='' method='post'><input type='submit' id='ajaxwel' class='".(getqrsitebooleans($companyqr,10002,'true') === 'true' ? 'togglebtn' : 'togglebtnon' )."' name='dotogglebool' value='". (getqrsitebooleans($companyqr,10002,'true') === 'true' ? 'skjul' : 'vis' ). "'><input type='hidden' name='mainsetup' value='1'><input type='hidden'  name='itemid' value='10002'></form></td><td>$tmptextholder</td></tr></table> 

what want send form off ajax , update buttons status, done class='".(getqrsitebooleans($companyqr,10002,'true') === 'true' ? 'togglebtn' : 'togglebtnon' )."'

but have no idea of how either. button has 2 states changed values in database, when clicked sends off post changes value in database, reloads site , reads change , shows changed status going green red,

i assume using $.ajax, not sure. greately appreciated.!

$.ajax(function(){   complete: function(){      $('#ajaxwel').prop('val','submit');    },   beforesend: function(){      $('#ajaxwel').prop('val','sending..');   } }); 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -