...

View Full Version : Refresh instead of replace?



sleidia
02-16-2009, 03:27 PM
Hi guys,

I've just read this short tutorial about Ajax : http://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX-Tutorial.html
I understand how easy it is to replace the content of a div by something else.

But how am I suppposed to do if, by the same Ajax technique, I just want to refresh a div whose content is supposed to change in accordance to the $_POST variable like in the example below?

As you can see, I'm trying to keep the HTML/PHP code structure as linear as possible to make it less confusing.



<?php

echo"

... some HTML ...

<div id=\"update_zone\">

";

if ($_POST["action"] == 1) {

echo"
page 1
";

} else if ($_POST["action"] == 2) {

echo"
page 2
";

} else {

}

echo"

</div>

... some HTML ...

";

?>



Thanks a lot to anyone who will help :)

sleidia
02-16-2009, 06:02 PM
I'm starting to think that my question isn't clear enough.
Do you guys actually understand what I'm trying to do?

PS : I don't need someone to write the JS code. I simply need to know where to look.

Thanks! ;)

ohgod
02-17-2009, 01:52 PM
no, it isn't totally clear what you're trying to accompish. if you're trying to replace certain sections of the page conditionally then pass the function that does the call an argument so it knows which one you want. or, set up a switch in the function so it will replace the contents of x based on $_POST['y'].



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum