I am trying to populate auto complete list by typing on textbox using jquery AJAX:
This is my code:
$("#formLoc").keyup(function(event){
var keyword = $("#formLoc").val();
if(keyword.length){
if(event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 13){
$.ajax({
'type':'GET',
'url': 'AIR_NAME_SEARCH_2.ASP',
data: "locKeyword="+keyword,
success: function(responseText){
alert(responseText);
if(responseText != 0){
$(".ajax_response").fadeIn("slow").html(msg);
}else{
$(".ajax_response").fadeIn("slow");
$(".ajax_response").html('<div style="text-align:left;">No station found!</div>');
}
}
});
}
});
AIR_NAME_SEARCH_2.ASP
<% @LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
<!--#include file="include/dataconn2.asp"-->
<%
set AIR=Server.CreateObject("ADODB.Recordset")
AIR.Open "select * from AIR_AIRPORT_INDIA WHERE AIRPORT_CODE = '" + Request.QueryString("locKeyword") + "' OR AIRPORT LIKE '" + Request.QueryString("locKeyword") + "%' ORDER BY AIRPORT",conn,1,3,1
RESPONSE.WRITE "<ul class='list-group'>"
FOR I=1 TO AIR.RECORDCOUNT
RESPONSE.WRITE "<li class='list-group-item'><a href='javascript:void(0);'><span class='bold'></span>" + AIR.FIELDS("AIRPORT") + "-" + AIR.FIELDS("AIRPORT_NAME") + " [" + AIR.FIELDS("AIRPORT_CODE")+ "]" + "</a></li>"
AIR.MOVENEXT
NEXT
RESPONSE.WRITE "</ul>"
%>
All i get is "retuned" and nothing after that. I check in firebug. Also I change the 'type':'GET' & request.form("locKeyword"), but nothing return. IF I directly hit this url (AIR_NAME_SEARCH_2.ASP?locKeyword=k) on browser i will return file. What would i be doing incorrect?