-
Ajax refresh/reload
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 } ?>
Similar Threads
-
By ajaxtoday in forum AJAX
Replies: 3
Last Post: 04-11-2007, 01:40 AM
-
By LeProgrammeur in forum AJAX
Replies: 3
Last Post: 09-12-2006, 02:31 AM
-
By moetarhini in forum AJAX
Replies: 0
Last Post: 06-14-2006, 06:28 AM
-
Replies: 2
Last Post: 06-03-2006, 07:45 PM
-
Replies: 0
Last Post: 02-09-2006, 01:26 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks