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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:42:11+00:00 2026-06-15T22:42:11+00:00

I am using the countTimer plugin for a little online exam app. The idea

  • 0

I am using the countTimer plugin for a little online exam app. The idea is when the timer reaches zero, I want to redirect the user to a given url (to an action called time_expired in the questions controller). So the url is in the form: /questions/:id/time_expired.

In the show.html.erb of questions controller, I have the following div element:

<div id="count-down" data-url=<%= time_expired_path %> ></div>

Its in this div that I display the timer.

Now in my application.js file I want to grap the value of the data-url attribute of my div and use expiryUrl to direct to that url.

$(document).ready(function(){

    myUrl = $("div").attr("data-url");
    alert(myUrl); // Prints undefine
    $('#count-down').countdown({expiryUrl: myUrl, format: 'MS', until: +10)
});

Why is the varibale “myUrl” undefined? I can check the value with firebug and there is indeed a url in my div.

Here is the firebug output:

<div id="count-down" data-url="/questions/2/time_expired"></div>

rails version: 3.2.8
Ruby Version : 1.9.3
Jquery: Jquery rails that comes shipped with rails

Any help and suggestion appreciated.

  • 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-15T22:42:12+00:00Added an answer on June 15, 2026 at 10:42 pm

    Try this instead:

    myUrl = $("#count-down").data("url");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using a populated Table Type as the source for a TSQL-Merge. I want to
Using InteliJ IDEA , I am trying to set up multiple projects to run
@using(Html.BeginForm(About, User, FormMethod.Post , new { id=aboutme})) { <fieldset> <ul> <li> <label class=block>About me</label>
using xmltextreader, how would I load a hashtable. XML: <base><user name=john>2342343</user><user name=mark>239099393</user></base> This was
Using WPF/PRISM I want to log my messages through ILoggerFacade to my GUI (A
Using CMake I want to check if a particular function (cv::getGaborKernel) from OpenCV library
Using The Play Framework how easy would it be to allow an admin user
Using batch script, I want to get a first token of a line delimited
Using Python, I'm trying to connect to my AppEngine app's remote_api handler, but I
Using PHP and MySQL, I want to query a table of postings my users

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.