[autocomplete] Need the value of an input field
I all !
I'm using the current version of jquery and make the first steps with this software. Actually I want to create a form with autocompletion. The difficulty is: I need two criterias to look for.
I need to fire up a sql-statement like this
select zip,street from streets where zip=$_GET['q'] and street=$_GET['additionalparameter']
But I don't get the value of my zip-field.
A
- console.log( $('#zip').val() );
brings "an empty string" in Firebug.
The rest of my autocomplete stuff works fine. But this is one problem I cannot solve. I cannot access to any value of my form.
Segment of my form:
- <label>PLZ</label> <input type="text" id="zip" name="zip"><br><br>
- <label>Strasse</label> <input type="text" id="street" name="street"><br><br>
Part of my autocomplete-js
- //console.log( $('#zip').val() );
- $("#strasse").autocomplete('search.php?what=street&add='+$('#zip').text(), {
- multiple: false,
- dataType: "json",
- parse: function(data) {
- return $.map(data, function(row) {
- return {
- data: row,
- value: row.to,
- result: row.name
- }
- });
- },
Thank you for guidance and best regards
Frank Becker