jQuery doesn't work without alert
<p>I have some JavaScript below, but it doesn't work unless I have the <code>alert</code> as shown below. I know this is some sort of timing issue, but I have no idea how to go about fixing it. Any thoughts?</p>

<pre><code>$(function() {
    $("#search_field").tokenInput("/searches/suggest_gems.json", {
    onAdd: function (item) {
    $('#search_field').val(item.name);
    // Doesn't work without alert("hi");
    },
    crossDomain: false,
    tokenLimit: 1,
    tokenValue: name
    });
});
</code></pre>
