Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
jdw_if_ajax: serve and hide content
The plugin is available here.
Since dub_if_ajax is no longer up for grabs: here’s jdw_if_ajax . This plugin is based off dub_if_ajax (no longer available) by Jamie Wilkinson. It uses the x-requested-with header to deliver different content to Ajax calls.
Addition of a new tag: jdw_if_not_ajax.
jdw_if_ajax
Container tag. When the page or form is requested by ajax, content will show.
<txp:jdw_if_ajax>
// code for ajax goes here
<txp:else />
//other code goes here
</txp:jdw_if_ajax>
jdw_if_not_ajax
Container tag. When the page or form is requested by ajax, content won’t show.
<txp:jdw_if_not_ajax>
// skipped by ajax
</txp:jdw_if_not_ajax>
Last edited by colak (2015-11-11 17:20:49)
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Re: jdw_if_ajax: serve and hide content
JanDW wrote:
Addition of a new tag: jdw_if_not_ajax.
Nice, thanks. I wondered when someone was going to update the original plugin. The addition of the not case is much more useful than it seems on the surface, so thanks for that too.
When I wrote smd_ajax a couple of years ago — designed as a complete AJAX implementation for delivering TXP articles — I also put the same ‘not’ case in and found myself using it almost exclusively during site development. I think my plugin’s only in use on one site on the Internet as I never officially released it due to a jQuery bug on IE and the fact I couldn’t get the history to work properly. Hmmm, perhaps I should revisit it now they’ve fixed at least one of those two issues…
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#3 2010-02-22 10:16:19
- jelle
- Member
- Registered: 2006-06-07
- Posts: 165
Re: jdw_if_ajax: serve and hide content
Bloke wrote:
Hmmm, perhaps I should revisit it now they’ve fixed at least one of those two issues…
ooohhh….yes please.
Offline
Re: jdw_if_ajax: serve and hide content
bring ‘er on, I say!
Last edited by JanDW (2010-02-22 16:24:17)
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Re: jdw_if_ajax: serve and hide content
Excellent Thanks !
As Stef says the <txp:jdw_if_not_ajax> case is very useful !
_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__
Offline
Re: jdw_if_ajax: serve and hide content
Cheers, Guillaume, glad you’re finding it useful.
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Re: jdw_if_ajax: serve and hide content
Jan, when serving, in a page template (pages tab) the:
<txp:jdw_if_ajax>
call_this_form
<txp:else />
call_the_whole_page
<jdw_if_ajax>
Outputs a blank page :(
Last edited by hablablow (2010-03-22 13:42:17)
_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__
Offline
Re: jdw_if_ajax: serve and hide content
You’ve omitted </txp: in the closing tag for </txp:jdw_if_ajax>, is that it?
edit: Ahh, so have I in the example up top, it seems, lemme fix that fixed.
Last edited by JanDW (2010-03-22 13:47:50)
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Re: jdw_if_ajax: serve and hide content
Also @Bloke
…the fact I couldn’t get the history to work properly
Last edited by JanDW (2010-03-22 14:09:36)
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
#10 2010-03-27 21:20:52
- sereal
- Member

- From: Indonesia
- Registered: 2010-02-18
- Posts: 55
Re: jdw_if_ajax: serve and hide content
is this plugin able to wrap the Comments Form ?
I’m looking for the way to make the Comments Form loads on a single DIV instead reload the whole page when the users clicking preview / submit button.
is that possible ?
please advise
thanks
$(mydocument).notyetready(function() {});
dowebsitesneedtolookexactlythesameineverybrowser ?
Offline
#11 2015-11-11 14:37:23
- dorka
- Member
- Registered: 2012-10-04
- Posts: 90
Re: jdw_if_ajax: serve and hide content
Hi there, the link to this usefull plugin is broken. Could someone, please, share a copy?
Thanks!
Offline
Offline
Re: jdw_if_ajax: serve and hide content
Well done michael. Let’s paste that here too for safe keeping:
# Name: jdw_if_ajax v0.1
# Type: Client side plugin
# Helper tags for TXP + AJAX
# Author: Jan De Wilde
# URL: http://www.jandewilde.com/
# Recommended load order: 5
# .....................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................
YToxMTp7czo0OiJuYW1lIjtzOjExOiJqZHdfaWZfYWpheCI7czo2OiJhdXRob3IiO3M6MTI6
IkphbiBEZSBXaWxkZSI7czoxMDoiYXV0aG9yX3VyaSI7czoyNjoiaHR0cDovL3d3dy5qYW5k
ZXdpbGRlLmNvbS8iO3M6NzoidmVyc2lvbiI7czozOiIwLjEiO3M6MTE6ImRlc2NyaXB0aW9u
IjtzOjI2OiJIZWxwZXIgdGFncyBmb3IgVFhQICsgQUpBWCI7czo0OiJoZWxwIjtzOjExNDQ6
Igk8aDEgY2xhc3M9InRpdGxlIHRhZyI+amR3X2lmX2FqYXg8L2gxPgoKCTxoMiBjbGFzcz0i
c2VjdGlvbiI+Q3JlZGl0PC9oMj4KCgk8cD5UaGlzIHBsdWdpbiBpcyBiYXNlZCB1cG9uIGR1
Yl9pZl9hamF4IChubyBsb25nZXIgYXZhaWxhYmxlKSBieSBKYW1pZSBXaWxraW5zb24uPGJy
IC8+Ckhvd2V2ZXI6IFRoaXMgcGx1Z2luIGhhcyBhIG5ldyB0YWc6IDxzcGFuIGNsYXNzPSJ0
YWciPmpkd19pZl9ub3RfYWpheDwvc3Bhbj4uPGJyIC8+Ckl0IHVzZXMgdGhlIHgtcmVxdWVz
dGVkLXdpdGggaGVhZGVyIHRvIGRlbGl2ZXIgZGlmZmVyZW50IGNvbnRlbnQgdG8gQWpheCBj
YWxscy48L3A+CgoJPGgyIGNsYXNzPSJzZWN0aW9uIj5UYWdzPC9oMj4KCgk8aDMgY2xhc3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29kZSI7czo0NDA6Ii8qIG9yZ2luYWxseSBkdWJfaWZfYWph
eCAqLw0KDQpmdW5jdGlvbiBqZHdfaWZfYWpheCgkYXR0cywgJHRoaW5nKQ0Kew0KCSRpc19h
amF4ID0gaXNzZXQoJF9TRVJWRVJbJ0hUVFBfWF9SRVFVRVNURURfV0lUSCddKSAmJiAkX1NF
UlZFUiBbJ0hUVFBfWF9SRVFVRVNURURfV0lUSCddICA9PSAnWE1MSHR0cFJlcXVlc3QnOw0K
CXJldHVybiBwYXJzZSggRXZhbEVsc2UoJHRoaW5nLCAkaXNfYWpheCkgKTsNCn0NCg0KZnVu
Y3Rpb24gamR3X2lmX25vdF9hamF4KCRhdHRzLCAkdGhpbmcpDQp7DQoJJGlzX25vdF9hamF4
ID0gIWlzc2V0KCRfU0VSVkVSWydIVFRQX1hfUkVRVUVTVEVEX1dJVEgnXSkgfHwgJF9TRVJW
RVIgWydIVFRQX1hfUkVRVUVTVEVEX1dJVEgnXSAgPT0gJyc7DQoJcmV0dXJuIHBhcnNlKCBF
dmFsRWxzZSgkdGhpbmcsICRpc19ub3RfYWpheCkgKTsNCn0NCg0KIjtzOjQ6InR5cGUiO3M6
MToiMCI7czo1OiJmbGFncyI7czoxOiIwIjtzOjU6Im9yZGVyIjtzOjE6IjUiO3M6MzoibWQ1
IjtzOjMyOiI4MjM1YWFmODM0MTQ4ZDBjOGI0MTc2OWMzZGM3NmJjMSI7fQ==
TXP Builders – finely-crafted code, design and txp
Offline
Re: jdw_if_ajax: serve and hide content
jakob wrote #296547:
Well done michael. Let’s paste that here too for safe keeping:
Excellent Idea that we all should do more. I have gotten paranoid, though, about saving things to Github after I had to recreate a plugin due to the textdrive demise.
Offline
Re: jdw_if_ajax: serve and hide content
jakob wrote #296547:
Well done michael. Let’s paste that here too for safe keeping:
Linked it from the front page of the threat too.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline