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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:10:47+00:00 2026-05-13T12:10:47+00:00

I have a remote_form which works 100% When a user clicks submit, it goes

  • 0

I have a remote_form which works 100%

When a user clicks submit, it goes out grabs so data from the db or data scraped from another website, and updates the page seamlessly…

The problem I’m having now, is that I’d like to do the same thing, but do it without having the user click the submit button with an onload event. I think I’m going about it the wrong way:

Technically this works… it does get the right data, but instead of doing exactly what the remote_form_tag does it returns the data raw. No RJS replace_html.

Is there a way to skip the form_for altogether and just execute the controller action directly when the page loads?

<script type="text/javascript">
    $(window).load(function() {
        // executes when HTML-Document is loaded and DOM is ready
        // jQuery.facebox('Big loading! <img alt=\"Loading\" src=\"/images/loaders/loading.gif\" />');
        //$("#update_form").submit();
        $("#update_form").submit(function () { return false; });

    });
</script>

The form for

#html.erb
<%  form_remote_tag :url => { :action => "update_availables", :id => params[:id] },
    :loading => "jQuery.facebox('Big loading! <img alt=\"Loading\" src=\"/images/loaders/loading.gif\" />');",
    :html => { :method => "get" },
    :method => "get",
    :html => { :id => 'update_form' } do %>

The controller

  def update_availables
    @do_it = Available.get_new_availables :id => params[:id], :date => user_cart.getDate.to_s
    get_availables

    respond_to do |format|
      format.html
      format.js
    end
  end

RJS

page.replace_html :rooms, :partial => "available"
page << "jQuery.facebox.close();"
  • 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-13T12:10:47+00:00Added an answer on May 13, 2026 at 12:10 pm

    Well, to get the same functionality as the user clicking the form you could use the javascript click method:

    $(window).load(function() {
    
        $("#update_form input[type='submit']").click();
    
    });
    

    But, if you’re submitting without any input from the user, why put the data in a form at all, why not just put an ajax call in the load handler which calls the action and updates the code directly?

    $(window).load(function() {
    
        $.ajax({
          type: "GET",
          url: "scraper_url",
          data: {field1:val,field2:val},
          success: function(responseText){
            // update page
          }
        });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.