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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:52:25+00:00 2026-06-18T09:52:25+00:00

I have a Sinatra app and there is an ajax method in it. Previously

  • 0

I have a Sinatra app and there is an ajax method in it. Previously it returns 200 and result. Now it starts returning 302 and result as which is still correct (I can see that in Google Chrome debug console).

Here is the xaml code:

    :javascript
        $(document).ready(function() { 
            $(document).on("click", "#my_id", function(){
              $.ajax({
                type: "GET",
                url: "/my_url",
                success: function(data){
                  window.location = data;
                }
            });
          });
        });


   def my_url
    #getting a data.....
    #returning the data... there is nothing unusual
  end

UPDATE:
That’s what I did:

  def my_url
    result = get_result()
    response.headers['Location'] = request.referer
    result
  end

but Location header in Response has not been changed and the error is remaining.

  • 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-18T09:52:26+00:00Added an answer on June 18, 2026 at 9:52 am

    302 is not an error code. It’s the HTTP status code for a redirect which you are doing by adding a Location header. Adding the Location header automatically changes the status code to 302. The only type of expected response for a 302 is something that a browser that doesn’t understand a 302 will see. For example, an HTML page explaining that it is a redirect with a link to the new page. For AJAX no response is expected for a 302 and the browser will fetch the results of the new location you are redirecting to.

    See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.3 for more details about HTTP status codes.

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

Sidebar

Related Questions

I have got Sinatra/Rails app and an action which starts some long process. Ordinary
I have a Sinatra app, that uses omniauth which constantantly gets this error attack
In my sinatra app i have a form which is used to submit data
I have a Sinatra app which would be used by different clients. I wish
I have a simple sinatra app on Heroku which fetches some json data and
We have a requirement to build a small Sinatra app which will capture events
I have a Sinatra app using Rack::Session::Cookie use Rack::Session::Cookie, :key => 'my.key', :path =>
I have simple Sinatra app. web.rb: require 'sinatra' get '/' do Hello end Gemfile:*
I have a Sinatra app that, boiled down, looks basically like this: class MyApp
I have a small Sinatra app with both a staging and production environment on

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.