Help! Can someone take a look at my HTML code with a simple search by terms function?


I am new to Twitter API and not an expert for webprogramming. Actually, I am trying to get the geocoordinates from tweets searched by some term like “earthquake”. So, here is HTML code. It always returns with an error of “bad request”. Could someone give me some advice? Thank you so much. Twitter API really freaks me out, why is there no any sample code about it online?

<!DOCTYPE html>
    <title>Test page</title>
    <!-- jquery external include -->
    <script src=""></script>

    <script type="text/javascript">
      /* document ready loop:
        - triggers anything inside once the HTML document
          is done loading
      $(document).ready(function() {
        // console.log is used to send text data to the console
        console.log('doc ready!');

        // a function called when a click event is registered on 
        // an element with the id of 'submit'
          // create a simple array with one member key 
          // this is the twitter search term, feel free to modify this
          var search_term = {
            q: 'bowery'
          // pass the search term to the search function defined below

        the main search function

        this takes a search term defined by 'search_term' and then uses the 
        jquery ajax function to connect to the twitter search api as outlined here:
        for more info on what you can do with the jquery ajax function see:
      function search(search_term) {
          /* the 'param' function ensures that our search terms are properly encoded
             see: */
          //url: '' + $.param(search_term),
		  url: '' + $.param(search_term),

          /* the data type should be set to jsonp. for more info on that see:
          dataType: 'jsonp',

          /* since the function runs asynchronously, we need to define what should happen
             when the twitter API sends back a successful response (i.e. HTTP code 200)

          success: function(data) {
            // uncomment the below to see the data in the console

            /* loop through each item inside of data['results'] and
               extract the 'text' property.
               we then use that to create a list item tag (<li>) and append
               that to the HTML element with id 'tweets'
            for (item in data['results']) {
                '<li>' + data['results'][item]['text'] + '</li>');
      <h1>NEW TWEETS</h1>
        <ol id="tweets"></ol>
        <a href="#" id="submit">get tweets</a>