We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: MX Ajax Detect (EE 1.6x / EE 2.x )

Development and Programming

Max Lazar's avatar
Max Lazar
337 posts
16 years ago
Max Lazar's avatar Max Lazar

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.

Download & Documentation

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

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

       
Max Lazar's avatar
Max Lazar
337 posts
15 years ago
Max Lazar's avatar Max Lazar

Update description and Documentation

       
bobh's avatar
bobh
145 posts
15 years ago
bobh's avatar bobh

This is fantastic, exactly what I need for a project I’m working on. I’m going to test it right now. Thanks a lot.

Edit: tested and highly recommended!

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
15 years ago
Mark Bowen's avatar Mark Bowen

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

       
Max Lazar's avatar
Max Lazar
337 posts
15 years ago
Max Lazar's avatar Max Lazar

Release v2.1 - compatible with EE 2.x.

       
Max Lazar's avatar
Max Lazar
337 posts
15 years ago
Max Lazar's avatar Max Lazar

Double post :(

       
etosha's avatar
etosha
11 posts
15 years ago
etosha's avatar etosha

Hello Max,

Uploaded it in system/expressionengine/plugins on a EE 2.0.1 install.

It doesn’t appear in the CP.

Any help ?

       
Max Lazar's avatar
Max Lazar
337 posts
15 years ago
Max Lazar's avatar Max Lazar

sorry, I don’t update the doc’s for v2 yet - in v2 all third_party addons must be copy to system\expressionengine\third_party\

       
Paradise's avatar
Paradise
84 posts
15 years ago
Paradise's avatar Paradise

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…

       
Max Lazar's avatar
Max Lazar
337 posts
15 years ago
Max Lazar's avatar Max Lazar

? 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)

       
Paradise's avatar
Paradise
84 posts
15 years ago
Paradise's avatar Paradise

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 😊

       
Max Lazar's avatar
Max Lazar
337 posts
15 years ago
Max Lazar's avatar Max Lazar

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}
       
Paradise's avatar
Paradise
84 posts
15 years ago
Paradise's avatar Paradise

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 :-(

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.