[autocomplete] Need the value of an input field

[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
  1. 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:      
  1. <label>PLZ</label>        <input type="text" id="zip" name="zip"><br><br>
  2. <label>Strasse</label>    <input type="text" id="street" name="street"><br><br>

Part of my autocomplete-js
  1.     //console.log( $('#zip').val() );
  2.     $("#strasse").autocomplete('search.php?what=street&add='+$('#zip').text(), {
  3.         multiple: false,
  4.         dataType: "json",
  5.         parse: function(data) {
  6.             return $.map(data, function(row) {
  7.                 return {
  8.                     data: row,
  9.                     value: row.to,
  10.                     result: row.name
  11.                 }
  12.             });
  13.         },

Thank you for guidance and best regards
Frank Becker