]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commit
Reveal modal: Fix confusing AJAX example 9299/head
authorDavid Reese <david@whatcould.com>
Wed, 26 Oct 2016 12:31:51 +0000 (08:31 -0400)
committerDavid Reese <david@whatcould.com>
Wed, 26 Oct 2016 12:51:11 +0000 (08:51 -0400)
commit3a65a8c1e0e25e0fb26601f8cb163a6865d5c377
treece340f13597936f86326e4e9ffdf29ac1cbd7607
parent35403dba68d493fcd1584623bef639c739774ed7
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')`.
docs/pages/reveal.md