05-09-2017, 07:41 PM
you could use ajax for that, i use this for form submission but you could adapt it for use with on change, your php logic can go into a separate php file making sure to incl. init.php and $db = DB::getInstance();
<pre></pre>
maybe that helps a little
<pre>
Code:
$('#form-id').submit(function(e){
e.preventDefault(); // Prevent Default Submission
$.ajax({
url: 'path-to-php-file',
type: 'POST',
data: $(this).serialize(), // it will serialize the form data
dataType: 'html'
})
.done(function(data){ // If success display alert
alert('Form Submit Successful ...');
})
.fail(function(){ // If fail display alert
alert('Form Submit Failed ...');
});
});
maybe that helps a little