chris wrote:
On Nov 6, 5:25 pm, "Jonathan Vanherpe (T&  T NV)"<jonat...@tnt.be>
wrote:
I guess you'll just need to add this:
$('div#menu').load($(this).attr('href')+' div#menu');

But I should warn you, this is far from efficient, as you're making 2
requests for the same page this way, instead of the one request it would
take to just load the page normally.

I personally think it's just not worth the effort, but I've told you
that before.

yes i figured that out, also solved the menu highlighting which was
just a CSS div order error on my part. this is how it works for the
moment:

<script src="http://code.jquery.com/jquery-latest.js";></script>
<script>
   $(document).ready(function(){
         $('#menu a').click(function(){
                 $('#maincontent').load($(this).attr('href')+'
#maincontent');
                $('.submenu').load($(this).attr('href')+' .submenu');
                 return false;
                 });
                });
</script>

in Safari on the mac it works, the pages load and the submenu loads,
however there is a problem with the submenu. on the first click of a
submenu item the page loads/refreshes completely but then when i click
on another submenu item it loads correcrly directly into the div
without refresh, and then alternately, once it loads into the div,
once it refreshes the whole page ..

in Firefox on the mac the first level menu and loading works but the
submenu doesn't appear

In Internet Explorer 8 the first level works 'sort of' on some clicks
it loads a page corrctly and on other clicks it doesn't load at all,
but it's random, i did a series of 10 clicks several times in a row
after cleaning cache each time and everytime it works/doesn't on some
other combination of pages ... after a dozen clicks or so it doesn't
load anything at all anymore ...

Do you have a link we can see this at?

in terms of efficiency and not being worth the effort, could you
elaborate your thoughts on this. the actual page content i am loading
through those calls is only very short text paragraphs (maincontent)
and a 4 item list (submenu). i have three columns:

[snip]
so i thought my solution would be more efficient than a traditional
refresh can you explain why i got it wrong ? for this site i don't
need bookmarking/history or back button browser functionality ...

Well, even though you're only showing part of the page, the whole page gets downloaded by your browser (twice, since you're calling load() twice). jQuery will download the whole page, then parse it, throw away what is doesn't need, and insert the small chunk you wanted into the page. Basically this is slower then just loading the page straight away (but I guess you don't see the flicker that's associated with a page load).


thx again for the help !

Jonathan

--
Jonathan Vanherpe - Tallieu & Tallieu NV - jonat...@tnt.be

Reply via email to