Is it Just Me or is the jQuery Fundamentals Chp 7 Ajax Solution Code not Working?
<p>I tried my hand at the first exercise for Chapter 7 (Ajax) in R Murphy's <a href="https://github.com/rmurphey/jqfundamentals" rel="nofollow">jQuery Fundamentals</a>. I now want to run the solution code to see how it's supposed to work. However when I copy/paste the code from the solutions/load.js file into my data/load.js file, save everything and reload the page it doesn't seem to work. All I get is the <code>console.log(id)</code> output that's called before <code>e.preventDefault()</code>. I was expecting the blog content from blog.html to appear on the page, underneath the headline in index.html "Blog post 1". </p>

<p><strong>Update with code</strong></p>

<p>Here's the jQuery source in question (from the file <a href="https://github.com/rmurphey/jqfundamentals/blob/master/solutions/load.js" rel="nofollow">solutions/load.js</a>):</p>

<pre><code>$(document).ready(function() {
    var $blog = $('#blog');
    $blog.find('h3')
        .each(function() {
            var     $this = $(this),
                $target = $('&lt;div/&gt;').insertAfter($this);

            $this.data('target', $target);
        })
        .click(function(e) {
            var     $this = $(this),
                $a = $this.find('a'),
                $target = $this.data('target'),
                href = $a.attr('href'),
                id = '#' + href.split('#')[1];

            console.log(id);
            e.preventDefault();

            $target.load('data/blog.html ' + id);
        });
});
</code></pre>

<p>As I understand it, the code should pull the html from <a href="https://github.com/rmurphey/jqfundamentals/blob/master/exercises/data/blog.html" rel="nofollow">data/blog.html</a> and replace the html that's in each of the three <code>&lt;li&gt;</code> in the $('div.module #blog') element. </p>

<p>However when I run the code that doesn't happen. No errors are generated in Firebug and the <code>console.log(id)</code> call works as expected, returning what looks to be the properly formed string in 'id'.</p>

<p>Am I mistaken about how this is supposed to work?</p>

<p>Thanks in advance,
n</p>
