NYCPHP Meetup

NYPHP.org

[nycphp-talk] Deep Linking with AJAX?

Brian Dailey support at dailytechnology.net
Thu Dec 14 12:01:11 EST 2006


I'm not quite sure I get your intent fully, but I think what you're 
going to want to do is include the actual URL in the link, and then do a 
javascript "return false" onclick. Add javascript to observe clicks on 
that link (by element id) and perform the ajax function using that.

I prefer to do this with scriptaculous - it ends up looking something 
like this

<a href="/link/here/" id="clickableLink" onClick="return false;">link</a>

<script type="text/javascript">
Event.observe('clickableLink', 'click', function doStuff { /* do this */ 
}, false);
</script>


Stephen Musgrave wrote:
> I have a designer who would like to have links on the subnav to NOT 
> refresh the page.  This could be done with iFrames, but best if done 
> with a DIV using AJAX.
> 
> However, from a usability perspective, I am concerned that the URL 
> displayed on the Location string is not the page they are looking at 
> after they have loaded an AJAX page.  If the user does a copy/paste into 
> an email to send to somebody, they will not arrive at the intended page.
> 
> I have looked at Christian Cantrell's article 
> <http://weblogs.macromedia.com/cantrell/archives/2005/06/deep_linking_in.cfm> 
> on the topic (though that's over a year old now) and the work-arounds 
> were less than convincing.
> 
> Does anybody know of a better technique to do this or is the consensus 
> that if I want the URL to reflect the actual page I am viewing, it 
> should be the old fashion way with page refreshes?
> 
> Thanks!
> 
> 
> 
> 
> 
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
> 
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
> 
> 



More information about the talk mailing list