Jquery global variable?
Jquery global variable?
Hello everxbody i have a big problem....
i want to read a inputfiel (land) and send this to my autocomplete file ... but this is not working there is always undefine... so how can i make this variable global that this is working? thank you very much
-
$("#land").change(function(){
$.myvariable = $("#land").val();
return $.myvariable;
});
$("#plz").autocomplete("searchplz.php?land="+$.myvariable,{
minChars: 1,
width: 200,
autoFill: false,
mustMatch: true,
formatItem: function(data) {
return data[0] +" "+ data[1];
},
formatResult: function(data) {
return data[0];
}
});