Jump to content

Hide, load, and show div with javascript


sjns

Recommended Posts

I have a few pages from each other to interact with page with id load, as below:

 

inside process.html

<div id="guest_details"> </div>

<div id="first_start"> </div>
<script>
<! -
$('#guest_details').load('?p=guest_details.html');
$('#first_start').load('?p=first_start.html')
$('#guest_details').hide('slow');
$('#first_start').SlideUp('slow')
->
</Script>

 

 

inside guest_details.html

 

<form action="guest_details.php" <form method="POST" id="guest">
<!-- Some cell here -->
<a onclick="$('#guest').submit();" class="button" id="first_start"> <span> <?php echo $button_submit;?> </span> </a>

</Form>

 

That I want is when the submit button is clicked then:

 

1. data sent to guest_details.php

2. If the data has been sent then hide <div id="guest_details"> </div>

3. showing the <div show id="first_start"> </div>

 

but when I make it like the above, that not work, Could someone give a clue how to correct?

 

Thanks a lot

Link to comment
Share on other sites

I will complete that code, hope someone can help me and I would appreciate it.

 

Here the complete code:

 

I have a few pages from each other to interact with page with id load, as below:

 

inside of page process.html as follows

 

    <form action="<?php echo $send; ?>" method="post" id="choose">//data send to process.php and redirect back to ?p=process (process.html page)
    <!--some options here -->
    <a onclick="$('#choose').submit();" class="button"> <span> <?php echo $button_next;?> </span></a>
    </form>
    
    <?php //if ($this->options->hasChosed()) { ?>
    <div id="guest_details"> </div>
    <?php //} ?>
    
    <?php if (isset($this->session->data['guest'])) { ?>
    <div id="first_start"> </div>
    <?php } ?>
    
    <script type="text/javascript">
    <!--
    $('#guest_details').load('?p=guest_details');
    $('#first_start').load('?p=first_start');
    $('#guest_details').hide('slow');
    $('#first_start').show('slow')
    -->
    </Script>

 

inside of page guest_details.html as follows

    <form action="<?php echo $send; ?>" method="POST" id="guest">//data send to guest_details.php and redirect back to ?p=process (process.html page)
    <!-- Some cell here -->
    <a onclick="$('#guest').submit();" class="button" id="first_start"> <span> <?php echo $button_next;?> </span></a>
    </Form>

 

inside of page first_start.html as follows

    <form action="<?php echo $send; ?>" method="POST" id="_start">/data send to first_start.php and redirect back to ?p=process (process.html page)
    <!-- Some cell here -->
    <a href="<?php echo str_replace($edit_guest_details); ?>" class="button"> <span> <?php echo $edit_guest;?> </span></a>
    <a onclick="$('#_start').submit();" class="button" id="f_start"> <span> <?php echo $button_next;?> </span></a>
    </Form>

 

situations:

 

page guest_details.html and first_start.html load inside process.html with using

 

load('?p=guest_details')

and

 load('?p=first_start')

 

by default guest_details.html is showing and first_start.html is hiding

 

Goals:

when guest_details.html form submited by click

<a onclick="$('#guest').submit();" class="button" id="first_start"> <span> <?php echo $button_next;?> </span></a>

then hide the page guest_details.html and show first_start.html

 

now at first_start.htm page

 

guest_details.html should be hide even so page refresh(f5), but

 

when button

<a href="<?php echo $edit_guest_details; ?>" class="button"> <span> <?php echo $edit_guest;?> </span></a>

 

clicked then guest_details.html show again

 

Looking for some pointers, Thanks in Advance

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.