1
I have a field select
and need to query and load the result dynamically with Ajax
. I currently have the following code (which does not appear to work or to be incomplete):
$('#formProd select').change(function(){
$.ajax({
type : 'POST',
url : 'index.php/home',
data : {id : $('#formProd select option:selected').val()}
});
});
How do I get this id to make me mine query?
I want to, by selecting an option from select
, that on the same page he takes the value of select
and make a query in my database to bring me the results.
Vide example.
When clicking on a category, I want you to click on a list of products.
details your question. Tell us in detail what you want to do. For example: where do you want to load the result? What is happening in your query above that you said is not working or incomplete? Things like that
– Tafarel Chicotti
Nesse php quando vc imprimir o
$_POST
he comes empty?– rray
If the question is:
"Como eu recebo essa id pra que eu faça minha query?"
Simply use$_POST['id']
inside the php file'index.php/home'
.– Paulo Roberto Rosa
No Paulo Roberto, this did not work. I want to know if the ajax I did is correct.
– dsantoro
Right it is, the argument
id
will filled by looking for firebug.– rray