Welcome to WebmasterWorld Guest from 107.21.175.43

Forum Moderators: open

Message Too Old, No Replies

Problem with ajax call

     

Juriy

1:58 pm on Aug 3, 2011 (gmt 0)



Guys plz need a help.

index page

<form id="form1" name="form1" method="get" action="show.php">
<select name="cg" onchange="SearchC();" id="catG" >
<option value="1" >&#1042;&#1057;&#1045; &#1050;&#1040;&#1058;&#1045;&#1043;&#1054;&#1056;&#1048;&#1048;</option>
<option value="2"<? if($pcat=="2")echo "selected='selected'"; ?>>subject</option>
<option value="3" <? if($pcat=="3")echo "selected='selected'"; ?>>faculty</option>
<option value="4" <? if($pcat=="3")echo "selected='selected'"; ?>>lecture</option>
</select>
</form>


then


function SearchC() {
var category = $("#catG").val();
var query = "searchbox.php?ct="+category;
$.ajax({
url: query,
success: function(data, textStatus, XMLHttpRequest) {
$("#searchcontents").html(data);
SearchCCallBack(false);
}
});
}




and searchbox.php

<?
if (($_GET['ct'] == '1'))
{
?>


<select name="subj" id="subj" class="textbox">
<option value="1"> math </option>
<option value="2"<? if WHAT TO WRITE HERE echo "selected='selected'";?>>phys</option>
</select>
<?php
} ?>



then Im moving to show.php i need to show appropriate "cg" and "subj" which I selected in index.php.

value for "cg" m passing like -> if (isset($_GET['cg'])){$pcat=$_GET['cg'];}

How to pass and make selected "subj" value in show.php?
 

Featured Threads

Hot Threads This Week

Hot Threads This Month