I want to submit a form and add a javascript variable with it. I tried using AJAX but that didn’t work properly because the form is cut in two parts on the same page. I’m now using a <button onclick='submit_form()'>send</button> which calls on the following function:
function submit_form()
{
document.getElementById("form2").submit();
}
however I need to pass on a javascript variable current_score I have it declared and it has a value I just don’t know how to add this to my submit function I tried using a return within the function itself and writing a function for it but neither worked 🙂 help and hints are greatly appreciated.
The idea is that people receive a score fill a form and send it to a database, The ajax script part was to try and pass the values on to the next page that will submit the data
Your question is not very clear. The simple way would be to append a get parameter to the URL you are requesting. The following example will append a hidden input element to your form: