From: David Reese Date: Wed, 26 Oct 2016 12:31:51 +0000 (-0400) Subject: Reveal modal: Fix confusing AJAX example X-Git-Tag: v6.3-rc1~47^2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9299%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Reveal modal: Fix confusing AJAX example The .done() callback receives the data from the $.ajax request; if the request format is HTML, that `resp` will just be a string, not an object. So `resp.html` returns undefined and is non-sensical. This only makes sense if the request format is JSON. Since my impression is most people are going to be hitting a URL that returns HTML, I'd suggest just changing the example to `$modal.html(resp)` as I've done in this pull request. If you expect most people to be making a request that returns JSON, I would at least imply that in the URL, eg `$.ajax('/api/url.json')`. --- diff --git a/docs/pages/reveal.md b/docs/pages/reveal.md index 68572f489..a1a6f0365 100644 --- a/docs/pages/reveal.md +++ b/docs/pages/reveal.md @@ -183,7 +183,7 @@ var $modal = $('#modal'); $.ajax('/url') .done(function(resp){ - $modal.html(resp.html).foundation('open'); + $modal.html(resp).foundation('open'); }); ```