$(document).ready(function () { $('#myForm').on('submit', function () { var question = $('input[name=quest]').val(); var answer = $('input[name=ans]').val(); $.ajax({ type: 'POST', url: 'latest.php', dataType: 'text', data: { quest: question, ans: answer }, success: function (result) { console.log(result); $('#message').html('Data saved successfully.'); }, error: function (e) { alert('Error: ' + e); } }); return false; }); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)