Monday, 2 September 2013

Error while calling asp classic function from javascript

Error while calling asp classic function from javascript

I am new to asp classic and trying to call asp classic function from
jquery ajax but it is giving 404 error. I want to return records in json
in this javascript code.
My javascript code is
$.ajax({
type: "POST",
url: "../dbFile.asp/GetAllRecords",
data: ("Id="10 "),
error: function(XMLHttpRequest, textStatus, errorThrown){
alert(textStatus);
},
success: function(result){
alert("success");
}
});
return false;
});
and my vb script function in asp classic file is
Function GetAllRecords()
dim cmd, rs
set cmd=Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = conn
cmd.CommandType = 4
cmd.CommandText = "GetAllRecords"
set rs=Server.CreateObject("ADODB.Recordset")
set rs=cmd.Execute()
set GetAllRecords= rs
set rs=nothing
set cmd=nothing
End Function
Please guide i am stuck here.

No comments:

Post a Comment