Timeout call

Hello, I am creating a system for online tests and need a hand to create a answer timeout. Here is the thing, the users only have 15 seconds to answer a question (and if it take them more than 10 seconds to answer they get less points for the question). After you start the test, each new question is displayed by ajax (I have a test_section div, each question answer is an ajax call to a function that will register the answer and update the section content with the next question data). Here goes the code of my _question.html.erb file with represent the partial file of each question:

<div id="test_section">   <%= periodically_call_remote(:update => "test_section", :frequency => 15, :url => { :controller => "answers", :action => "registerAnswer", :id => 0, :question_id => question.id, :language_id => language.id }) %>   <h2 class="title">Test <%= question.test.name %> > <%= "#{t("Question")} #{question.number}" %></h2>   <%= question.getText(language) %>   <p style="margin-left:20px;">     <% question.answers.each do |answer| %>       <%= link_to_remote(answer.getText(language), :update => "test_section", :url => { :controller => "answers", :action => "registerAnswer", :id => 0, :answer_id => answer.id, :language_id => language.id }) %>       <br />     <% end %>   </p>   <%= periodically_call_remote(:update => "timer", :frequency => 1, :url => { :controller => "answers", :action => "updateTimer", :id => 0 }) %>   <div id="timer" class="textos">     <%= render :partial => "/shared/test/answer_timer", :locals => { :timer => 15 } %>   </div> </div>

The first periodically_call_remote element was an intent for the 15 seconds timeout but the thing is it keeps on being fired even after the div is updated. Checking on the internet I found this is because the ajax call still exists in memory...I'm trying to figure out another way of solving this but am kind of stuck here. Any idea?

PD: I tried to use a setTimeout call but didn't work, the function called in the setTimeout is never executed...