title: Submit a JQuery form with Enter key press
body: <p>I've tried various solutions, but none are suitable for my particular case!
  How can I make it so that when the user presses 'Enter' the form submits &amp; searches.</p>
  
  <p>I am using rotten tomatoes API with AJAX by the way.</p>
  
  <p><strong>FORM</strong></p>
  
  <pre><code>&lt;form name="myform" action="" method="GET"&gt;&lt;h3 class="white"&gt;Search for a movie here!:&lt;/h3&gt;&lt;br&gt; 
      &lt;input type="text" id="inputbox" value=""&gt;&amp;nbsp;
      &lt;input type="button" id="button" value="Go!" onClick="filmlist(this.form)"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>ajax.js</strong></p>
  
  <pre><code>function filmlist(form) {
      $('#films table').empty(); //removes previous search results before adding the new ones.
      var apikey = "APIKEY";
      var baseUrl = "http://api.rottentomatoes.com/api/public/v1.0";
      var moviesSearchUrl = baseUrl + '/movies.json?apikey=' + apikey;
      var query = form.inputbox.value; //uses the value from the input box as the query search
      $(document).ready(function () {
          // sends the query
          $.ajax({
              url: moviesSearchUrl + '&amp;q=' + encodeURI(query),
              dataType: "jsonp",
              success: searchCallback
          });
      });
      // receives the results
      function searchCallback(data) {
          $('#films table').append('Found ' + data.total + ' results for ' + query);
          var movies = data.movies;
          $.each(movies, function (index, movie) {
              $('#films table').append('&lt;tr&gt;&lt;td width="70" rowspan="2"&gt;&lt;a href="' + movie.links.alternate +
                  '" title="Click here to view film information for ' + movie.title + '."&gt;&lt;img class="ajaximage" src="' + movie.posters.thumbnail + '" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;td class="ajaxfilmlisttitle"&gt;&lt;h3&gt;&lt;a href="' + movie.links.alternate +
                  '" title="Click here to view film information for ' + movie.title + '."&gt;' + movie.title + '&lt;/a&gt;&lt;/h3&gt;Release year: ' + movie.year + '&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="ajaxfilmlistinfo"&gt;Audience Score: ' + movie.ratings.audience_score +
                  '&lt;br&gt;' + 'Cinema Release Date: ' + movie.release_dates.theater +
                  '&lt;br&gt;Runtime: ' + movie.runtime + ' minutes&lt;/td&gt;&lt;/tr&gt;');
          });
      }
  }
  </code></pre>