Javascript ajax fill issue
<p>I am working on a module and have copied the formatting off other pages but it does not seem to work.  Is is meant to get the value from House Location and create a page slug in the box underneath.  The Form class is crud and I can't get any error with Firebug.</p>

<p><strong>Controller Function:</strong></p>

<pre><code>function stream_slug()
{
    $this-&gt;load-&gt;helper('text');

    $this-&gt;output-&gt;set_output( url_title($this-&gt;input-&gt;post('location'), 'underscore', TRUE) );
}
</code></pre>

<p><strong>HTML:</strong></p>

<pre><code>&lt;label for="location"&gt;House Location:&lt;/label&gt; &lt;input type="text" name="location" value="" maxlength="250" /&gt;&lt;span class="required-icon tooltip"&gt;Required&lt;/span&gt;&lt;/li&gt; 

&lt;li class="even"&gt; 
&lt;label for="slug"&gt;House Slug&lt;/label&gt; 
&lt;input type="text" name="slug" value="" maxlength="60" /&gt;&lt;span class="required-icon tooltip"&gt;Required&lt;/span&gt; 
&lt;/li&gt; 
</code></pre>

<p><strong>jQuery:</strong></p>

<pre><code>(function($) {
    $(function(){

        form = $('form.crud');

        $('input[name="location"]', form).keyup($.debounce(300, function(){

            slug = $('input[name="slug"]', form);

            $.post(BASE_URI + 'index.php/admin/sales/stream_slug', { title : $(this).val() }, function(new_slug){
                slug.val( new_slug );
            });
        }));

    });
})(jQuery);
</code></pre>

<p><strong>Updated jQuery:</strong></p>

<pre><code>(function($) {
    $(function(){

        form = $('form.crud');

        form.find('input[name="location"]', form).keyup($.debounce(function(){

            slug = $('input[name="slug"]', form);

            $.ajax(BASE_URI + 'index.php/admin/sales/stream_slug', { title : $(this).val() }, function(new_slug){
                slug.val( new_slug );
            });
        }, 300));

    });
})(jQuery);
</code></pre>

<p><strong>debounce:</strong></p>

<pre><code>/*
 * jQuery throttle / debounce - v1.1 - 3/7/2010
 * http://benalman.com/projects/jquery-throttle-debounce-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&amp;&amp;!h){l()}h&amp;&amp;clearTimeout(h);if(i===c&amp;&amp;m&gt;e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);
</code></pre>
