Web Design Forum: Loading content into div - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Loading content into div How to load content into div?

#1 User is offline   Str8TalkingBob 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 14
  • Joined: 02-January 10
  • Reputation: 0

Posted 07 January 2010 - 05:50 PM

Hi all, i'm pretty new to Javascript but have been using html and css for many many years. Finding the javascript language quite hard to learn in comparison but am getting there slowly.

What i'm trying to do is load html content that i have stored in an "includes" folder into a div on my index page when clicking a link i a menu that is in another div on my index page, the said menu is also in the "includes" folder and called into my index page using the php include function.

I've managed a couple of ways of doing this using a couple of jquery snippets i found on the web which have worked with some success. But what i'm truing to do is change the url when new content is loaded into the div. eg. when a link is clicked on "www.mydomain.com" "newcontent.html" is loaded into my content div and the url changes to "www.mydomain.com/newcontent.html" i've been told by a good few people that yes, it is possible but i have yet to find the correct method of doing this.

If anyone here can help me accomplish this i would be very greatful.

Thankyou in advance,
0

#2 User is offline   rallport 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 3,813
  • Joined: 03-January 10
  • Reputation: 266
  • Gender:Male
  • Location:England, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 07 January 2010 - 10:55 PM

Wrote a bit of blog post on it a while go - showing how to load content into a div using ajax - also touches on cache handline when making such requests:

simple content loading with jquery


If you can't get your code to work after that, send me pm over and I'll help out :)

EDIT: can help with the content loading via jquery/ajax, but not with your url issue. As far as I'm aware you can't change the page url via ajax as by definition using ajax you silently loading content with a page refresh. I know you can append anchors onto the url through E.g. www.site.com/page.php#newcontent (maybe this is what people meant?)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users