Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 02-20-2007, 05:05 PM Ajax refresh/reload
Extreme Talker

Posts: 196
Trades: 0
Im using this script, http://www.captain.at/howto-ajax-form-post-get.php, to make an ajax request to php via a drop-down (DD) select. This works fine. Then using this script, http://www.dhtmlgoodies.com/index.ht...ynamic-content, i request to show a php page with other form elements in it. These elements are determined by what the first DD of the first request (captain.at) sets a variable to. This works fine.. only the first time though. What seems to be happening is that even though each time a DD option is selected, the variable changes as it should, but when the second script fires it still shows the previous variable. Its like the div is not reloading the page with new vars set, its just showing the page it first ran. I have tried to make another call to show a different page, this works for clearing content of the div, which i want, but not making the div reload with a page using fresh vars. I hope i got my point across.

My main question i think is, how, when i call the dhtmlgoodies script, can i get the div/page to show using the newest variable? Here is some stripped out important code.

index.php
Code:
<select id="sale_type_id" name="sale_type_id" onmousedown="ajax_loadContent('search','ajax_search_blank.php');" onchange="makeRequest('ajax_search.php?sti=',this.value);ajax_loadContent('search','ajax_search.php');">

    <? $_stt = db_query("SELECT sale_type_id, sale_type_name FROM sale_type WHERE sale_type_id <> 43 ORDER BY sale_type_name ASC");
    while($stt = db_fetch_array($_stt)) { ?>
        <option value="<?php pv($stt['sale_type_id']); ?>"><?php pv($stt['sale_type_name']); ?></option>
    <? } ?>

</select>

<p>

<DIV id="search"></DIV>
ajax_search.php
Code:
<? 
/*   set the sale_type id for the search drop down.   */
if(isset($_GET['sti'])) {

    $_SESSION['sti'] = $_GET['sti'];

}elseif(isset($_SESSION['sti'])) { 

    $_stt = db_query("
    Select distinct
    sale_type_field.sale_type_field_name,
    sale_type_field.sale_type_field_id
    From
    sale_type_field
    JOIN connector_sale_type_field ON sale_type_field.sale_type_field_id = connector_sale_type_field.sale_type_field_id
    Where
    connector_sale_type_field.sale_type_id = '".$_SESSION['sti']."'
    ORDER BY
    sale_type_field.sale_type_field_name ASC
    ");
    while($stt = db_fetch_array($_stt)) {
        $sale_type_field_id[] = $stt['sale_type_field_id'];
        $sale_type_field_name[] = $stt['sale_type_field_name'];
    } ?>

    <select name="search_field[]">
        <option value=""></option>
        <option value="sale_id">Sale Id</option>

        <?php for ($j = 0; $j < count($sale_type_field_name); $j++) { ?>

            <option value="<?php pv($sale_type_field_id[$j]); ?>"><?php pv($sale_type_field_name[$j]); ?></option>

        <?php } ?>

    </select>

<?php } ?>
empiresolutions is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Ajax refresh/reload
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.07877 seconds with 12 queries