In an Autocomplete select: option function, I define a variable as a function. The variable does not execute this function. It completely skips it. I get no error in the Console, but when I follow execution line by line. I get the following at that line, which I don't understand.
- citiesWithBoroughs: function (request, response){
- get arguments: function ThrowTypeError() { [native code] }
- get caller: function ThrowTypeError() { [native code] }
- length: 2
- name: ""
- prototype: Object
- set arguments: function ThrowTypeError() { [native code] }
- set caller: function ThrowTypeError() { [native code] }
- __proto__: function Empty() {}
- <function scope>
The select: option looks like this.
select: function (event, ui){
$(this).val(ui.item.value);
$("#hiddenState").val(ui.item.abbrev);
citiesWithBoroughs = function (request, response){
alert("|" + $("#hiddenState").val() + "|cWB"); //does not fire
$.ajax({
url: "getCitiesWithBoroughs.php",
data: {
stateProvinceAbbreviation: $("#hiddenState").val(),
countryAbbreviation: $('input[name=country]:checked').val() },
type: "POST",
dataType: "text",
success: function (data){
response(data);
alert(data); //does not fire
});
}
citiesWithBoroughs();
}
The variable is declared outside the Autocomplete widget.
var citiesWithBoroughs = [];
I have tried 2 sequential functions in the select: option, and the page does not load. Why does the variable throw those errors at run time, and what do they mean?
Thanks for any insight you have about this.