-
Object Expected Error
Hi,
I'm trying to call an ASP function within Javascript.... But it keeps returning the error : "Object Expected" when the ASP function is called.... Can you help me resolve this??
Thanks
Justin
Hi,
I'm trying to get the below code working... But it seems to be throwing an error when the function hitcount(fn) is called... Im trying to call an ASP function within Javascript... Can any one please help with this :
-- Javascript code --
<script LANGUAGE="JavaScript1.2" >
function checkurl(fn)
{
str = "http://webhost.in/PNM/Book/<%=gotorpt%>/" + fn;
if (str.indexOf ("web//") > 0)
{
alert("Please Select a Month!");
}
else
{
str2 = "http://webhost.in/PNM/Book/counter.asp?choserpt=Y&whichyrmth=" + str;
hitcount(fn); -- Error occurs here : Object Expected
self.location.href = str;
}
return;
}
</script>
--ASP function --
<%
function hitcount(fn)
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "..\Hits\hitcounter.mdb" -- Database
conn.Mode = 3
set rs = Server.CreateObject("ADODB.Recordset")
set SQL = "UPDATE Application_counter SET Application_counter.[Counter] = Application_counter.Counter+1 where pdf='"+fn.substring(0,8)+"';"
rs.Open SQL,conn,1,3
document.write(rs(0))
rs.Close()
cn.Close()
end function
%>
Last edited by jscheuer1; 05-16-2011 at 04:51 PM.
-
-
to call a server-side function from the client you must use something like AJAX
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks