[jQuery] Help with combox

[jQuery] Help with combox


Hello my people,
I am in some problems with a self populated combobox
I want to make something from this:
category
-- PlayStation - 1
-- XBOX - 2
(From here they are automatically populated so I will by this as an
example)
Platform
-- PSP - 1
-- PS3 - 2
-- XBOX 360 -3
Games
-- Jogo1 PSP - 1
-- Game 2 PS3 - 2
-- Game 3 PS3 - 3
So how is to edit, stated that the box were "Selected" with the value
coming from the mysql (the table news)
ie the news had
category = 1
platform = 2
game = 2
then the selects were well
category
-- PlayStation - 1 - selected
--- XBOX - 2
Platform
-- PSP - 1
-- PS3 - 2 - selected
( disappeared a xbox 360 porque a plataforma escolhida foi a
plataforma Playstation)
Games
-- Game 2 PS3 - 2 - selected
-- Game 3 PS3 - 3
(PSP Jogo1 the game disappeared pk selects the category is the PS3)
The way I auto popolate ja jquery with the following code:
$().ready(function() {
$("select[@name=categorias]").change(function(){
$('select[@name=plataforma]').html('<option value="">A
carregar Plataformas</option>');
$.post('procura_plataforma.php', { categoria : $
(this).val() }, function(resposta){
$('select[@name=plataforma]').html(resposta);
}
);
});
$("select[@name=plataforma]").change(function(){
$('select[@name=jogos]').html('<option value="">A carregar
dados</option>');
$.post('procura_jogos.php', { estado : $(this).val() },
function(resposta){
$('select[@name=jogos]').html(resposta);
}
);
});
});
The problem now this, if I have selected the category Playstation
(with data from the sql), to open the page it does not select the
population of platforms and "select" automatic the value (in this case
- PS3 - 2) and turn does not make it to select the games
I am desperate even with this will be someone who can help me?
Greetings and thank you