How to submit a form with javascript? I have an exposed views form, am geolocating in javascript and setting the co-ordinates in the exposed form. 

This form submits properly when I click on the 'apply' button but does not when I use javascript to submit the form. The page refreshes, but the values have not been changed.

The form is standard FAPI. It is not a views-ajax form although I would like to move to ajax at some point in the future when I sort out the problems with gmaps + ajax.

Both of the following fail.

jQuery('#edit-submit-studio-locations').click();
jQuery('#views-exposed-form-studio-locations-page').submit();


The full code is in github.
Add this code inside Drupal.behaviors.    

$('.views-exposed-form APPLY_BUTTON ID/class').click(function() {
  // Submit the form
  (this).parents('form').submit();
});


Hope it works.