MizziPizzi MizziPizzi - 1 year ago 137
Ajax Question

filling div using ajax?

I've recently created a website with a menu-bar to the left. My next step is to update the right side of the page with content based on what option you choose on the in the menu. I know you can use iframe but I was wondering if there is an alternative to it, like a more dynamic one!

Most of the menu options are input-forms, I've read about ajax-calls to fill a div but couldn't find a good tutorial on how to achieve it.


Here's a sketch http://imageshack.us/photo/my-images/16/smlithis.png/

Answer Source

You can use jQuery This is how your menu button will look like:

<a href='#' onclick='return fillDiv(1)'>GoTo1</a>  
function fillDiv(pageNum){
  $("#id_of_div_to_load_to").load("some_page.php",{ 'pahe_num': pageNum } );  
return false;  

It is just one of many ways to do it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download