Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-16-2009, 03:27 PM   PM User | #1
sleidia
New Coder

 
Join Date: Aug 2006
Posts: 50
Thanks: 4
Thanked 0 Times in 0 Posts
sleidia is an unknown quantity at this point
Refresh instead of replace?

Hi guys,

I've just read this short tutorial about Ajax : http://rajshekhar.net/blog/archives/...-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.

Code:
<?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 is offline   Reply With Quote
Old 02-16-2009, 06:02 PM   PM User | #2
sleidia
New Coder

 
Join Date: Aug 2006
Posts: 50
Thanks: 4
Thanked 0 Times in 0 Posts
sleidia is an unknown quantity at this point
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!
sleidia is offline   Reply With Quote
Old 02-17-2009, 01:52 PM   PM User | #3
ohgod
Regular Coder

 
ohgod's Avatar
 
Join Date: Jun 2008
Location: Ohio
Posts: 579
Thanks: 6
Thanked 69 Times in 69 Posts
ohgod is on a distinguished road
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'].
ohgod is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:44 AM.


Advertisement
Log in to turn off these ads.