Results 1 to 2 of 2

Thread: Object Expected Error

  1. #1
    Join Date
    May 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

  2. #2
    Join Date
    Feb 2011
    Posts
    16
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    to call a server-side function from the client you must use something like AJAX

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •