Reputation: 633
I have a problem with my select field, because I can't catch the value of an option, my code:
<form method="get" name="form1" >
<select id="rpc" onchange="$('#rpc').load('aja.province.php?cod=this.value')">
how can I send the value to the option in a PHP file with method GET?
Best Regards.
Upvotes: 0
Views: 586
Reputation: 71384
If you are using jQuery, I would suggest removing the inline stuff and just do something like this in your source:
$('#rpc').change( function () {
var url = 'aja.province.php?cod=' + this.value;
load(url, function () {
// do whatever you need to do with returned value
}
});
Note that your current in-line load()
call is passing a literal string of this.value
for the cod
parameter.
Upvotes: 1
Reputation: 388316
$('#rpc').load('aja.province.php?cod=this.value')
should be $('#rpc').load('aja.province.php?cod='+this.value)
.
this.value
is not a string, it is a javascript expression.
Upvotes: 3