I am using JavaScript and AJAX to send form data to a php processing file to then populate an SQL database without refreshing the initial form page.
The php/SQL connec
Were it me i would just make this easier on myself by using the Form plugin. Its already got an ajaxSubmit
set of functions to make ajaxify your form with little effort. IT also has the handy formSerialize
function which will serialize a form for ajax submission or to append to a query string for a link. :-)
That said an easier way without the plugin and utilizing your existing code:
$("#form_process").click(function() {
$.ajax({
type: "POST",
url: "**ABSOLUTE URL TO PROCESSOR**",
data: {
'choice': $("input[@name=RadioGroup1]:checked").val(),
'comments': $("#comments").val()
}
});
});
Either way though, you also need to change all your radio inputs to have unique ID's (or no ID at all)... you cant use the same one as its required that all id attributes have unique values within the document.