title: How do I get a query button to repeat post while a button is held down?
body: <p>I'm using POSTs to send commands to an arduino.  I want the up command to be repeated while the button is held down.  Here is what I'm trying...</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;&lt;/title&gt;
  
          &lt;link rel="stylesheet" href="../templates/mainkibblynibblytemplate/css/kibbly-jquery.css" /&gt;
          &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
          &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          var timeout, clicker = $('#upbutton');
  
          clicker.mousedown(function () {
                            timeout = setInterval(function () {
                                                  $.post('http://192.168.1.77:8888/', {
                                                         text: 'up'
                                                         });
                                                  }, 500);
  
                            return false;
                            });
  
          $(document).mouseup(function () {
                              clearInterval(timeout);
                              return false;
                              });
          &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;button id="upbutton"&gt;Test&lt;/button&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>