Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8338381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:34:33+00:00 2026-06-09T04:34:33+00:00

I am unable to call a javascript function as it says Object Expected. I

  • 0

I am unable to call a javascript function as it says “Object Expected”. I am using asp.net and this is being used on a standard aspx page with some usercontrols. One of the user controls called CookieControl calls a javascript method setandCheckCookie() on document.ready.i.e

$(document).ready(function() {
         setandCheckCookie();
)};

In the head section on my aspx page I have reference the javascript file before I add the control:

<script src="CookiesControl/js/Cookie.js" type="text/javascript"></script>
<uc2:Cookie ID="Cookie1" runat="server" />

I’ve event tried adding the script reference on the user control itself but when I go to my aspx page I get the object expected error.

I don’t believe its the control or the js file as both these are used elsewhere in the website and they work fine but something I’m doing is stopping the js file from being reference because in firebug and IE debugger I can’t see the referenced js file.

Perhaps the path is incorrect but I have dragged the script from the solution explorer and visual studio isn’t complaining about the path either.

So my question is: what could potentially stop my javascript file from being referenced.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:34:35+00:00Added an answer on June 9, 2026 at 4:34 am

    Visual Studio complaining or not about a path is not always saying what you’ll get in the browser. To check if the script is referenced ok, try to get the script file in the browser. For example, if you page is at http://yoursite/yourpage.aspx and your script reference in the html code (by View Source, not what you see in Visual Studio) is folder/scriptFile.js, put this address http://yoursite/folder/scriptFile.js and see if you get the file. If not, then it is not referenced ok.
    To solve issues like that, put the full path after yoursite, like:

    <script src="/ScriptVirtualFolder/CookiesControl/js/Cookie.js" type="text/javascript"></script>
    

    where ScriptVirtualFolder is in your site root folder, and it is a virtual folder, means it is accessible by the browser in this path.
    Also, you can use asp.net to resolve your path by using the ~ sign and runat='server'. For example:

    <script src="~/ScriptServerFolder/CookiesControl/js/Cookie.js" type="text/javascript" runat="server"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to call the __doPostback javascript function in a asp.net page from
Possible Duplicate: How to call a JavaScript function from PHP? I have a php
My aspx page:- <script src=js/jquery-1.4.2.js type=text/javascript></script> <script src=js/jquery-ui-1.8.2.custom.js type=text/javascript></script> <script type=text/javascript> $(document).ready(function () {
the methods below used to work but now I get this error: Error: Sys.Net.WebServiceFailedException:
Why does IE complain about this javacript call? $.get(profile_completeness.php?id=<?php echo($user_id); ?>, function(data) { var
So i am trying to learn object oriented programming in javascript. function doStock() {
When I try and call .dataBind() on a Telerik Grid object in javascript, it
I have JavaScript function call to changeMapLocation function where in it I want to
I'm currently trying to call a function with a custom parameter, however I'm unable
I'm have some difficulties here, I am unable to successfully call a method which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.