|
Project Information
Featured
Downloads
Links
|
Aboutjquery-fragments allow you to use the default jQuery $.load() to load multiple web fragments in one ajax query. How it works?With jquery-fragments you can update the differents sections of a web with only one ajax query controled by the server not by client's javascript. You can replace, delete, append or prepend content of almost any tag of a document without any line of code. To understand how it works the better is a example. Imagine a HTML document like this: <html>
<head>
</head>
<body>
<div id="main_content">
Main content of the web. We want to update it with ajax!.
</div>
<div id="sidebar">
<div id="sidebar_block_1">This is a sidebar block. Sometimes it changes.</div>
<div id="sidebar_block_2">
This is another sidebar block,
always changes with the content.
</div>
<div id="sidebar_block_3">This is another sidebar block.
Never changes, or maybe it chages sometimes? I don't know :P
</div>
</div>
</body>
</html>We want a fully ajax web and the content of the #main_content div is loaded via ajax (maybe using jquery-address). This is good and fast but... what happends when the others sections of the document changes?. We can load the others sections anytime the content is changed but we need to program each block load and make a lot of requests to the server. With jquery-fragments you can change the differents secctions of the document in a very easy way. For example if our load() request return this: <div id="main_content"> Update main content! </div> <div id="sidebar_block_2"> Update sidebar's block content! </div> Only the content of #main_content and #sidebar_block_2 content will be updated. If we add new blocks or decide that we want to change another block we only need to modify the server response. Now we want to add content (not replace) to the #sidebar_block_3. This is very simple: <div id="main_content"> Update main content! </div> <div id="sidebar_block_3" class="fragments-append"> <br/>This content will be appended to the block! </div> The result will be: <html>
<head>
</head>
<body>
<div id="main_content">
Update main content!
</div>
<div id="sidebar">
<div id="sidebar_block_1">This is a sidebar block. Sometimes it changes.</div>
<div id="sidebar_block_2">
This is another sidebar block,
always changes with the content.
</div>
<div id="sidebar_block_3">This is another sidebar block.
Never changes, or maybe it chages sometimes? I don't know :P
<br/>This content will be appended to the block!
</div>
</div>
</body>
</html>Features
Upcoming features
|