Permalink
Browse files

Success callback now given data from ajax call

1 parent 0546e3d commit 6d26cfe9181ce1ce80afdf48598fad7d8f04353d @meltingice committed Apr 9, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −1 docs/ajax-chosen.html
  2. +1 −1 lib/ajax-chosen.js
  3. +1 −1 lib/ajax-chosen.min.js
  4. +1 −1 src/ajax-chosen.coffee
View
@@ -52,7 +52,7 @@
<span class="p">.</span><span class="nx">appendTo</span><span class="p">(</span><span class="nx">select</span><span class="p">)</span>
</pre></div> </td> </tr> <tr id="section-22"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-22">&#182;</a> </div> <p>Tell chosen that the contents of the <select> input have been updated
This makes chosen update its internal list of the input data.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">select</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s2">&quot;liszt:updated&quot;</span><span class="p">)</span>
- </pre></div> </td> </tr> <tr id="section-23"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-23">&#182;</a> </div> <p>Finally, call the user supplied callback (if it exists)</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">success</span><span class="p">()</span> <span class="k">if</span> <span class="nx">success</span><span class="o">?</span></pre></div> </td> </tr> <tr id="section-24"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-24">&#182;</a> </div> <p>For some reason, the contents of the input field get removed once you
+ </pre></div> </td> </tr> <tr id="section-23"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-23">&#182;</a> </div> <p>Finally, call the user supplied callback (if it exists)</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">success</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span> <span class="k">if</span> <span class="nx">success</span><span class="o">?</span></pre></div> </td> </tr> <tr id="section-24"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-24">&#182;</a> </div> <p>For some reason, the contents of the input field get removed once you
call trigger above. Often, this can be very annoying (and can make some
searches impossible), so we add the value the user was typing back into
the input field.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">field</span><span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">&#39;value&#39;</span><span class="p">,</span> <span class="nx">val</span><span class="p">)</span></pre></div> </td> </tr> <tr id="section-25"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-25">&#182;</a> </div> <p>Because non-ajax Chosen isn't constantly re-building results, when it
View
@@ -48,7 +48,7 @@
}
});
select.trigger("liszt:updated");
- if (typeof success !== "undefined" && success !== null) success();
+ if (typeof success !== "undefined" && success !== null) success(data);
field.attr('value', val);
return field.css('width', 'auto');
};
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -100,7 +100,7 @@ do ($ = jQuery) ->
select.trigger("liszt:updated")
# Finally, call the user supplied callback (if it exists)
- success() if success?
+ success(data) if success?
# For some reason, the contents of the input field get removed once you
# call trigger above. Often, this can be very annoying (and can make some

0 comments on commit 6d26cfe

Please sign in to comment.