
29.08.2009, 16:14
|
|
Участник форума
Регистрация: 11.10.2006
Сообщений: 134
Провел на форуме: 3607644
Репутация:
235
|
|
Реализация с помощью jQuery.
Код:
<script src='js/jquery.js' type='text/javascript'></script>
<script type="text/javascript">
$(document).ready(function(){
$('#soft').click(function() {
$.ajax({
type: "POST",
url: "jres2.php",
data: "type="+1,
success: function(html){
$("#categories").html(html);
}
});
});
$('#games').click(function() {
$.ajax({
type: "POST",
url: "jres2.php",
data: "type="+2,
success: function(html){
$("#categories").html(html);
}
});
});
});
</script>
<input name="soft" type="button" value="софт" id="soft"/>
<input name="games" type="button" value="игры" id="games"/>
<div id="categories">
</div>
Софт это тип=1, игры=2.
PHP код:
<?php
if($_POST['type'] == '1') {
$html = '<select name="spisok">
<option>Soft 1</option>
<option>Soft 2</option>
</select>
';
echo $html;
}
if($_POST['type'] == '2') {
$html = '<select name="spisok">
<option>Game 1</option>
<option>Game 2</option>
</select>
';
echo $html;
}
?>
Последний раз редактировалось diGriz; 29.08.2009 в 16:36..
|
|
|