I'm a bit of a Javascript noob but I need to submit a form using "post" in Javascript to a website, but I am using some conditions in my code and it looks something like this:
function submitForm()
{
   if(condition == true)
           {
               //submit the form
           }
           else{
               //do not submit the form
           }
}
Is this possible to do? I couldn't find anything online but I thought I might ask here before I try and figure out al alternative.
Might be worth mentioning that this function gets called from a button's onclick in HTML as an event.
 
    