How do I trigger an AJAX submit button on page load? I am attempting to trigger a form (to get live data) on a page load. So far, I have this code I have found from bits and pieces and digging around the net, but unfortunately not a lot of people actually appear to have needed to do this.

jQuery(document).ready(function($) {
  var element_settings = {};
  var element = {};
  element_settings.progress = { 'type' : 'throbber' };
  element_settings.submit = { js: true };
  var ajax = new Drupal.ajax($('#edit-ratessubmit'), element, element_settings);
  element.form.clk = element;

  ajax.form.ajaxSubmit(ajax.options);
});


This currently complains that element_settings doesn't contain a URL, but when it does contain a URL, I get some random "b is undefined" error.
This was a simple case of targeting the correct element using the code below.

$(document).ready(function() {
    $('#edit-submit').trigger('click');
}