0

I am currently just working on simple and final UI changes for a website I am working on and was wondering if someone could help me figure something out.

I have a page that has three divs on it and I was wondering how I could use javascript to reload the content of these divs without reloading the page when someone clicked on a certain link?

Thanks!

1
  • try ajax and you should be through Commented May 14, 2012 at 7:27

3 Answers 3

1

Use AJAX. Watch here

Or as suggested in other answers - use a framework or a library like jQuery which makes element selection and AJAX as easy as possible

Sign up to request clarification or add additional context in comments.

Comments

1

in case you need to go to the server to get the content: read about AJAX. there is a good jQuery framework making ajax calls very easy.

if you don't need to go to the server just select the element you need and change his innerHTML value. again - you can select elements via jQuery in a more easy way.

Comments

1

To reload this div you can use ajax call.

With your ajax call, your get your data, without reloading the page, and then replace your div content with the new data.

something like that

$.ajax({
 type : 'get',
 url : 'urltogetdata',
 success : function(data){
   $('#yourdiv').html(data);
 }
});

this code is jquery code, but it work with other lib

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.