Web Development with jQuery®

(Elliott) #1

Loading HTML Snippets from the Server (^) ❘ 195
LOADING HTML SNIPPETS FROM THE SERVER
In the previous sections, you’ve seen how to request data from the server using the XML and JSON
data transport formats. The other popular way of transporting data from the server to the client
asynchronously is via HTML snippets. Using this method, you request small chunks of HTML as
you need them without the , , and tags.
The following example (Example 7-4) demonstrates how to load snippets of HTML with jQuery’s
load() method:
<!DOCTYPE HTML>






Folder Tree









  • data-id='1'
    title='/'>
    Macintosh HD



    • data-id='5175'
      title='/Applications'>

      Applications

      class='folderTreeHasChildren'
      data-id='5175'
      alt='+'
      title='Click to expand.' />




    • data-id='5198'
      title='/Library'>

      Library

      [http://www.it-ebooks.info](http://www.it-ebooks.info)
Free download pdf