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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:05:17+00:00 2026-05-23T13:05:17+00:00

When I redirect in a post going back to the page that shows the

  • 0

When I redirect in a post going back to the page that shows the form, JQuery mobile shows me the results instead of the form.

Lets say I have three resources:

/ => Just shows a link to the /redirect_to resource, this is to test
/redirect_to => GET: Shows a form to say your name in /thank_you
/redirect_to => POST: Just redirects to /thank_you showing the name that you input
/thank_you => GET: Shows a text "Thank you name!"

After I get to the Thank You! page, if I try to go back home, and then go to /redirect_to I get the content of /thank_you instead of the form of /redirect_to, if I refresh the page I get the form.

So instead of looking at the form to redirect_to I see the thank_you page.

Here is the code in Sinatra if you don’t understand it, at this point I’ll re-write it in Flask, Snap, Rails, Django (my app is on Django)… but it should be good enough to read. Here is the code on Github (Since StackOverflow doesn’t detect my ruby): https://gist.github.com/1061639

To run the app you basically install sinatra: gem install sinatra

And run it: ./jquerymobile_redirect_error.rb

#!/usr/bin/env ruby

require 'rubygems'
require 'sinatra'

get '/' do
  <<-end_page
<!DOCTYPE html> 
<html> 
  <head> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />
    <script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
  </head>
  <body>
    <div data-role="page">
      <div data-role="header" data-position="fixed">
        <h1>JQuery Error</h1>
        <a href="/" data-icon="home">Home</a>
        <a href="/" data-icon="delete">Logout</a>
      </div><!-- /header -->

      <div data-role="content">
        <h1>Go to /redirect_to <a href="/redirect_to">here</a>.
      </div><!-- /content -->

      <div data-role="footer" data-position="fixed">
        <h1>Footer</h1>
      </div><!-- /footer -->
    </div><!-- /page -->
  </body>
</html>
  end_page
end

get '/redirect_to' do
  <<-end_page
<!DOCTYPE html> 
<html> 
  <head> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />
    <script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
  </head>
  <body>
    <div data-role="page">
      <div data-role="header" data-position="fixed">
        <h1>JQuery Error</h1>
        <a href="/" data-icon="home">Home</a>
        <a href="/" data-icon="delete">Logout</a>
      </div><!-- /header -->

      <div data-role="content">
        <form action="/redirect_to" method="post" accept-charset="utf-8">
          <p><label for="name">Name</label><input type="text" id="name" name="name" value="" id="name" placeholder="input your name">
          <p><input type="submit" value="Redirect to /thank_you &rarr;"></p>
        </form>
      </div><!-- /content -->

      <div data-role="footer" data-position="fixed">
        <h1>Footer</h1>
      </div><!-- /footer -->
    </div><!-- /page -->
  </body>
</html>
  end_page
end

post '/redirect_to' do
  redirect "/thank_you/#{params[:name]}"
end

get '/thank_you/:name' do |name|
  <<-end_page
<!DOCTYPE html> 
<html> 
  <head> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />
    <script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
  </head>
  <body>
    <div data-role="page">
      <div data-role="header" data-position="fixed">
        <h1>JQuery Error</h1>
        <a href="/" data-icon="home">Home</a>
        <a href="/" data-icon="delete">Logout</a>
      </div><!-- /header -->

      <div data-role="content">
        <h1>Thanks #{name}!</h1>
      </div><!-- /content -->

      <div data-role="footer" data-position="fixed">
        <h1>Footer</h1>
      </div><!-- /footer -->
    </div><!-- /page -->
  </body>
</html>
  end_page
end
  • 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-23T13:05:17+00:00Added an answer on May 23, 2026 at 1:05 pm

    Specify data-url for your thank_you page. That forces change of url on form submit.

    <div data-role="page" data-url="/thank_you">
    

    I found that info from the docs under Redirects and linking to directories.

    This also allows you to return urls that change as the result of a redirect, for example, you might post a form to “/login.html” but return a page from the url “/account” after a successful submission.

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

Sidebar

Related Questions

I have an HTML form page which I post back to itself in order
After processing form from POST I should redirect, to prevent user from hitting back.
Suppose we have the xhr 'POST' request that returns 'redirect' status code. In that
How can in controller redirect with post same data like this do form <form
I'm using the Post/Redirect/Get pattern on a form of mine. I've never used this
I have a user control which contains the following code: <form id=CurrencyForm method=post runat=server>
I'm new to post/redirect/get. I'm coding up the first real site that led me
I have a usercontrol on a page that has a login control in it.
I have a thread that loops receiving socket data and printing it: def post(self):
I have a JSP page that has 2 forms running on Tomcat 6. One

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.