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 529787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:07:41+00:00 2026-05-13T09:07:41+00:00

setTimeout(refresh(), 2*15000); This is a code from my JavaScript. Here setTimeout is a built

  • 0
setTimeout("refresh()", 2*15000);

This is a code from my JavaScript.

Here setTimeout is a built in function and refresh is a function which I have declared.

I want to pass a variable (cval1) to this refresh function.

I have tried this:

setTimeout("refresh(cval1)", 2*15000 );

But it’s not working.

What is the exact way to do this?

  • 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-05-13T09:07:42+00:00Added an answer on May 13, 2026 at 9:07 am

    As first parameter of setTimeout pass a function instead of a string, so you have access to all variables in current scope.

    setTimeout(function(){refresh(cval1)}, 2*15000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this simple function in javascript to refresh a page after a set
I have a JavaScript function buildTable which builds a very long HTML table. function
Why this doesn't work in Firebug console: function(s,e) { setTimeout(function(){grvClosingDocs.Refresh();CBPDocFlow.PerformCallback();},100) } While this does:
Does setTimeout work from WITHIN setInterval ? I'm writing some JavaScript to animate some
I have this jQuery AJAX code, when the request is successful, it does this:
I am trying to run small snippet code in JavaScript, where I want to
I'm trying to refresh a classic report with this code and it works fine
For whatever reason, I can't get this function repeat. Once it gets the setTimeout,
i'm currently have a problem by using the SetTimeOut function. The thing is that
I have a timer to refresh the page, and it's working: updateCountdown = function()

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.