Data Ajax
A basic AjaxLoader wrapper that inserts AJAXed in content.
Insert content after an element (data-ajax-after
)
Example
Hello World
Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.
Hello World - Part 2
Different example text. Different example text. Different example text. Different example text. Different example text. Different example text.
View code
In-page HTML
<section data-ajax-after="ajax/data-ajax-extra-en.html" class="original">
<h4>Hello World</h4>
<p>Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.</p>
</section>
<section data-ajax-after="ajax/data-ajax-extra-2-en.html" class="original">
<h4>Hello World - Part 2</h4>
<p>Different example text. Different example text. Different example text. Different example text. Different example text. Different example text.</p>
</section>
data-ajax-extra-en.html
<section class="ajaxed-in">
<h4>J'ai été affiché via Ajax</h4>
<p>J'ai été affiché via Ajax. J'ai été affiché via Ajax. J'ai été affiché via Ajax. J'ai été affiché via Ajax. J'ai été affiché via Ajax. J'ai été affiché via Ajax. J'ai été affiché via Ajax.</p>
</section>
data-ajax-extra-2-en.html
<section class="ajaxed-in">
<h4>I was ajaxed in - Part 2</h4>
<p>I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2.</p>
</section>
Append content to an element (data-ajax-append
)
Example
Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.
Different example text. Different example text. Different example text. Different example text. Different example text. Different example text.
View code
In-page HTML
<div data-ajax-append="ajax/data-ajax-extra-en.html" class="original">
<p>Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.</p>
</div>
<div data-ajax-append="ajax/data-ajax-extra-2-en.html" class="original">
<p>Different example text. Different example text. Different example text. Different example text. Different example text. Different example text.</p>
</div>
data-ajax-extra-en.html
<section class="ajaxed-in">
<h4>I was ajaxed in</h4>
<p>I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in.</p>
</section>
data-ajax-extra-2-en.html
<section class="ajaxed-in">
<h4>I was ajaxed in - Part 2</h4>
<p>I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2.</p>
</section>
Insert content before an element (data-ajax-before
)
Example
Hello World
Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.
Hello World - Part 2
Different example text. Different example text. Different example text. Different example text. Different example text. Different example text.
View code
In-page HTML
<section data-ajax-before="ajax/data-ajax-extra-en.html" class="original">
<h4>Hello World</h4>
<p>Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.</p>
</section>
<section data-ajax-before="ajax/data-ajax-extra-2-en.html" class="original">
<h4>Hello World - Part 2</h4>
<p>Different example text. Different example text. Different example text. Different example text. Different example text. Different example text.</p>
</section>
data-ajax-extra-en.html
<section class="ajaxed-in">
<h4>I was ajaxed in</h4>
<p>I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in.</p>
</section>
data-ajax-extra-2-en.html
<section class="ajaxed-in">
<h4>I was ajaxed in - Part 2</h4>
<p>I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2.</p>
</section>
Prepend content to an element (data-ajax-prepend
)
Example
Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.
Different example text. Different example text. Different example text. Different example text. Different example text. Different example text.
View code
In-page HTML
<div data-ajax-prepend="ajax/data-ajax-extra-en.html" class="original">
<p>Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.</p>
</div>
<div data-ajax-prepend="ajax/data-ajax-extra-2-en.html" class="original">
<p>Different example text. Different example text. Different example text. Different example text. Different example text. Different example text.</p>
</div>
data-ajax-extra-en.html
<section class="ajaxed-in">
<h4>I was ajaxed in</h4>
<p>I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in.</p>
</section>
data-ajax-extra-2-en.html
<section class="ajaxed-in">
<h4>I was ajaxed in - Part 2</h4>
<p>I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2.</p>
</section>
Replaces an element (data-ajax-replace
)
Example
Hello World
Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.
Hello World - Part 2
Different example text. Different example text. Different example text. Different example text. Different example text. Different example text.
View code
In-page HTML
<div data-ajax-replace="ajax/data-ajax-extra-en.html" class="original">
<section>
<h4>Hello World</h4>
<p>Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.</p>
</section>
</div>
<div data-ajax-replace="ajax/data-ajax-extra-2-en.html" class="original">
<section>
<h4>Hello World - Part 2</h4>
<p>Different example text. Different example text. Different example text. Different example text. Different example text. Different example text.</p>
</section>
</div>
data-ajax-extra-en.html
<section class="ajaxed-in">
<h4>I was ajaxed in</h4>
<p>I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in.</p>
</section>
data-ajax-extra-2-en.html
<section class="ajaxed-in">
<h4>I was ajaxed in - Part 2</h4>
<p>I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2. I was ajaxed in - Part 2.</p>
</section>
Filtering the content by the URL hash (ajax/data-ajax-extra-en.html#filter-id
, v4.0.12+)
Example
Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.
View code
In-page HTML
<div data-ajax-append="ajax/data-ajax-filter-en.html#filter-id" class="original">
<p>Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.</p>
</div>
data-ajax-filter-en.html
<section id="filter-id" class="ajaxed-in">
<h4>I was ajaxed in and filtered by the URL hash</h4>
<p>I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in.</p>
</section>
<section class="ajaxed-in filter-selector">
<h4>I was ajaxed in and filtered by a selector</h4>
<p>I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in.</p>
</section>
Filtering the content by a selector (ajax/data-ajax-extra-en.html .filter-selector
, v4.0.12+)
Example
Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.
View code
In-page HTML
<div data-ajax-append="ajax/data-ajax-filter-en.html .filter-selector" class="original">
<p>Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.</p>
</div>
data-ajax-filter-en.html
<section id="filter-id" class="ajaxed-in">
<h4>I was ajaxed in and filtered by the URL hash</h4>
<p>I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in.</p>
</section>
<section class="ajaxed-in filter-selector">
<h4>I was ajaxed in and filtered by a selector</h4>
<p>I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in.</p>
</section>
Alternative syntax
Consult the documentation for more information regarding the following alternative syntaxt.
Example
Hello World
Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.
View code
In-page HTML
<div data-wb-ajax='{
"url": "ajax/data-ajax-extra-en.html",
"type": "append"
}' class="original">
<section>
<h4>Hello World</h4>
<p>Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text. Example text.</p>
</section>
</div>
data-ajax-extra-en.html
<section class="ajaxed-in">
<h4>I was ajaxed in</h4>
<p>I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in. I was ajaxed in.</p>
</section>
Conditional filtering using HTTP Referrer
AJAX-in content on the condition that the HTTP Referrer matches the httpref
value. Use regular expression to refine your HTTP referrer to a broader range of pages.
To be used for promotional content that is not pertinent to task completion. If you have multiple httpref, see documentation for advanced usage.
Example
This content will be replaced if you browse to this page from the French version of this page
View code
<div data-wb-ajax='{
"url": "ajax/httpref.html#enlang",
"type": "replace",
"httpref": "data-ajax-fr.html"
}'>
<p>This content will be replaced if you browse to this page from the <a href="../data-ajax-en.html">French version of this page</a> page</p>
</div>
- Date modified: