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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:01:00+00:00 2026-05-31T07:01:00+00:00

I am working on a website in which a user drags a file into

  • 0

I am working on a website in which a user drags a file into a div, and the file is uploaded to a server running Sinatra through AJAX (XHR level 2). I want to get the response from Sinatra, as JSON, and then POST to another route with information from the JSON. This POST should result in another page being rendered.

I have got it to where I can upload the file, and get back a response. How would i do the rest?

P.S: I don’t want to use GET, because some of the information shouldn’t be in the URL.

Thanks in advance.

  • 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-31T07:01:01+00:00Added an answer on May 31, 2026 at 7:01 am

    Not exactly the way you want. You would have to get the JSON data as string in subsequent POST call.
    The idea is to create form element on the fly and use it to make subsequent POST call.

    javascript code

    $.post("/test1/frm", {param1 : "param"}, function(d){
      if(d.success) {
        // subsequent POST call on success use commented code in case subsequent request is XHR
        //$.post(d.url, d.response_data, function(dd){/*callback if any*/});
        var frm = $("<form method='POST'>").attr("action", d.url).append($("<input name='data'>").attr("value", JSON.stringify(d.response_data)));
        frm.submit();
      }
    });
    

    controller code

    post :frm do
      logger.debug params.inspect
      content_type :json
      {:success => true, :url => "/test1/frm_post", :response_data => {:a => :b}}.to_json
    end
    post :frm_post do
      logger.debug params.inspect
      "success"
    end
    

    Note you would need to replace controller code with key – values with actual use case.

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

Sidebar

Related Questions

I am working on a website which already has user access set up so
I am working on a experimental website (which is accessible through web browser) that
I am working on a website which the good user inputs a website domain
I am working on is a website which features: user signup user login add
I am working on a website which loads its data via AJAX. I also
I'm working on a website in which I should take data from a user
I'm working on a website which has advert banners which link to external pages.
i am working on a website which deploy on web farms to serve high
I am currently working on a website which lists the businesses as per either
I'm working on an ASP.NET website which targets desktop browsers. We want to enable

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.