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

  • Home
  • SEARCH
  • 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 6119029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:30:16+00:00 2026-05-23T15:30:16+00:00

I have this code in my create.js.erb file: pollingAJAX(); function pollingAJAX() { $.ajax({ method:

  • 0

I have this code in my create.js.erb file:

pollingAJAX();

function pollingAJAX() {

    $.ajax({
        method: "POST",
        url: "/status",
        data: {uuids: '<%= @uuid_hash.to_json %>'},
        },
        success: function(data){
            var obj = $.parseJSON(data);
            if(obj.isDone == "yes"){

            }else{
                obj.each(function(result) { 
                  if(result.status == "completed"){
                     $('a[href="#{result.url}"]').html('');
                  }
                });
                pollingAJAX();
            }    
        }
    });
}

This AJAX request is not being triggered because my create.js.erb file is not being rendered. I have this code in my create action:

result['items'].each do |r|
 # escaped_url = URI.escape(r['link'], Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")).gsub("%","-")
  @site_array << r['link']
  if Result.where(:link => r['link']).present?
  else  
    job_id = ImageGenerator.create(:url => r['link'])
    @uuid_hash[r['link']] = job_id
  end   
end
respond_to do |format|
  format.html
  format.js
end  

I think it may have to do with the fact that I am processing a bunch of background jobs with Resque before calling respond_to?

How can I get my create.js.erb file to be triggered?

  • 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-23T15:30:17+00:00Added an answer on May 23, 2026 at 3:30 pm

    UPDATE: Make sure you’re actually including your JavaScript with a <script> tag, otherwise it will never be loaded.

    Move the invocation of pollingAJAX() to after that function has been defined. Provided it (lexically) parses ok, JavaScript executes linearly, as it’s interpreted, rather than compiled and then executed, so the pollingAJAX() function doesn’t yet exist where you’ve put the invocation.

    Also, always view your source code in the browser, to make sure the .erb has processed the way you intended. And make use of your JavaScript console in your browser to detect any errors.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code working in C#: var request = (HttpWebRequest)WebRequest.Create(https://x.com/service); request.Method = GET;
I have the this code that will create excel file and work sheet then
I have this in my create.js.erb file: if ($(.none).length){ $(.none).replaceWith('<ul class=shown_users_list><li id=<%= dom_id(@showable_video) %>><%=
I have this code to create an ATOM feed Dim xmlResult As New StringBuilder
I have this code which should create a splash image with either no animation
I have this webdav code thats creating folders in SharePoint: HttpWebRequest request = (System.Net.HttpWebRequest)HttpWebRequest.Create(folderAddress);
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have a python script the runs this code: strpath = sudo svnadmin create
I'm using PHP5 to create XML files. I have code like this: $doc =
I have this code in my html.erb at many places. <div id=left-nav> <%= render

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.