Uncaught Typeerror: Object Has No Method Autocomplete And Its Blocking To Populate Dialogue Box To Delete In Yii

I’m sorry similar post is already there in the community, But i’m finding it strange. Its working fine but it affected my other views and not allowing other view pages to populate any dialogue boxes…

I tried to fix it by wrapping it in function() like this


$('#_auto').autocomplete(function(){

But, with this i’m not getting jason values in the _auto textfield and getting unexpected token error with following line.

can anyone help me to solve this please.


source: function(request,response){

this is my code:


$(function () {

		$('#_auto').autocomplete({

			selectFist: true,

			minLength: 2,

			source: function (request, response) {

				var sval = $('#_auto').val();

				//alert(sval);

				$.ajax({

					url: BASE_URL + '/controller/search/',

					type: 'POST',

					data: {

						'term': sval,

					},

					dataType: 'json',

					success: function (data) {

						console.log(data);

						var dta = [];

						orgdetails = [];

						//response(data.d);

						for (var i in data) {

							dta.push(data[i].name);

							orgdetails[data[i].name] = data[i].id;

						}

						response(dta); //response(dta);

					},

					error: function (result) {}

				}); //ajax

			}

		}).focus(function () {

			$(this).trigger('keydown.autocomplete');

		});

	});

Many Thanks