MX Ajax Detect is a small and simple plugin detect is template was request by AJAX or not. For example, you create a website where all links opens in modal windows by ajax. But what happened if user turned off his javascript? The better to bee sure that user will see a full page not only simple block for modal windows. One of way is to use Ajax Detect plugin.
Hiya,
Don’t suppose you could explain to the Ajax illiterate (read me 😉 ) exactly what we (read me again 😉 ) can do with this plugin. Sounds interesting but unfortunately my Ajax skills are definitely not where I would like them to be at the moment so any pointers on the plugin and what it can do would be great for me, thanks.
Best wishes,
Mark
Hi Max,
Just wanted to say that I had a need for this plugin just today and now that I understand what it’s for I can definitely go on record as saying it’s really great 😊
Nice, simple plugin but really helps with what I’m doing for a UI that I’ve AJAXified.
Thanks for releasing this one for us to work with.
Best wishes,
Mark
Hm, i’m to stupid for it?
On my homepage i load some stuff in jquery overlays. But i want people who have turned of JS to see the content. So i need a link for the overlay and another one to another template.
{exp:ajax_detect}
{if ajax}
<a href="http://{url_title_path=%27group/template-overlay%27}" rel="#sum">{product_featured_image}</a>
{if:else}
<a href="http://{url_title_path=group/template-nooverlay}">{product_featured_image}</a>
{/if}
{/exp:ajax_detect}
It doesnt matter if i have JS on or off, i allways get the template-nooverlay path…
? could you please specify - you put this code
{exp:ajax_detect parse="inward"}
{if ajax}
Here we embedded(or just insert) short images layout
{if:else}
Here we embedded(or just insert) page with full images page layout
{/if}
{/exp:ajax_detect}
to page witch upload by ajax(for example, displayed in modal windows), correct ? And in modal windows and by using direct link you see the same information? (if you website online – could you please send me url to PM)
p.s. (I add parse=”inward” because in your case it will be better to parsing tags this way)
No the code is not in the ajax overlay its on my homepage (group/index.html)
I have a template (group/template1.html) this is the side that i want the user to see if javascript is off.
<a href="http://{url_title_path=group/template1.html}">normal link</a>
Then i have a template that is just blank content (no header, sidebar and so on). This template i want to load in an overlay(lightbox).
<a href="http://{url_title_path=group/template2.html}">normal link</a>
So what i need is that the user with javascript on gets the link to overlay.html on the homepage.
You can read more about my problem here http://www.sitepoint.com/forums/showthread.php?t=659677 I thought MX Ajax Detect is the solution 😊
yes, MX Ajax Detect is possible your solution, but you need to thinking the different way - this plugin helps your to display the same template/page with different content base on request type. If you request it by JS - you will see content between {if ajax}{if:else}, if user don’t have ajax, he just go to the page and will see content between {if:else} {/if} try to create template with this code bellow and used it with for you $(“a[rel]”).overlay({…)} (with JS enable/disable):
{exp:ajax_detect parse="inward"}
{if ajax}
Here we embedded(or just insert) short images layout
{if:else}
Here we embedded(or just insert) page with full images page layout
{/if}
{/exp:ajax_detect}
Ok, it works. Now i know how and its a great way, cause there is just one link needed. What is parse=“inward” for?
Ok, this works for modal windows, overlays, lightboxes or however people call it 😊. Now i was on my way to build the categories page and did it the same way. BUT, it doesn’t work. Hm, then i had the enlightenment. The page is not a modal and is called via a normal link.
Ok, I know there is no save way to check if somebody has JS on. And i saw you to it via the XMLHttpRequest. Here is my idea:
Can we (you) make a parameter that we can put in the url that checks the XMLHttpRequest like it is Ajax even its not? A fake ajax/jquery link 😊. Something like:
<a href="http://{path=">Link</a>
Or maybee it can be done with jQuery and a class in the link. Like:
<a href="http://{path=" class="jcheck">Link</a>
Sorry im really not a php or JS guy :-(
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.