Hacker News new | ask | show | jobs
by psherman 4812 days ago
Assuming you give your form elements names and the form an ID (unlike in the linked example) its trivial to get the query string using serialize and you don't have to fuss around with string formatting if you modify the form.

    $.ajax({
      url: 'ajax-example.php',
      data: $('#myForm').serialize(),
      success: function(data) {
          $('#ajaxDiv').html(data);
      }
    });