cities change function var _this this ajax url list university _this v

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$("#cities").change( function() {
var _this = $(this);
$.ajax( {
url : "/list/university/" + _this.val(),
dataType : 'json',
success : function(data) {
var items = [], i = 0, index = [], l = data.length, d;
for (i = 0; i < l; i++) {
d = data[i].split('|');
items[i] = d[0];
index[d[0]] = d[1];
}
$("#univers").autocompleteArray(items, {
delay : 10,
minChars : 1,
maxItemsToShow : 10,
formatItem : function(row, i, num) {
return row;
/*var result = row[0].split('|')[0] + "<em>" + row[1] + "</em>";
return result;*/
},
width : 300,
onItemSelect : function (item) {
$("#faculty").load("/list/faculty/" + index[item.selectValue] + "/html");
}
});
}
});
});