title: Error with Redirects in JQuery Mobile
body: <p>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.</p>
  
  <p>Lets say I have three resources:</p>
  
  <pre><code>/ =&gt; Just shows a link to the /redirect_to resource, this is to test
  /redirect_to =&gt; GET: Shows a form to say your name in /thank_you
  /redirect_to =&gt; POST: Just redirects to /thank_you showing the name that you input
  /thank_you =&gt; GET: Shows a text "Thank you name!"
  </code></pre>
  
  <p>After I get to the <em>Thank You!</em> page, if I try to go back home, and then go to <code>/redirect_to</code> I get the content of <code>/thank_you</code> instead of the form of <code>/redirect_to</code>, if I refresh the page I get the form.</p>
  
  <p>So instead of looking at the form to <code>redirect_to</code> I see the <code>thank_you</code> page.</p>
  
  <p>Here is the code in <strong>Sinatra</strong> 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): <a href="https://gist.github.com/1061639" rel="noreferrer">https://gist.github.com/1061639</a></p>
  
  <p>To run the app you basically install sinatra: <code>gem install sinatra</code></p>
  
  <p>And run it: <code>./jquerymobile_redirect_error.rb</code></p>
  
  <pre><code>#!/usr/bin/env ruby
  
  require 'rubygems'
  require 'sinatra'
  
  get '/' do
    &lt;&lt;-end_page
  &lt;!DOCTYPE html&gt; 
  &lt;html&gt; 
    &lt;head&gt; 
      &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" /&gt;
      &lt;script src="http://code.jquery.com/jquery-1.6.1.min.js"&gt;&lt;/script&gt;
      &lt;script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div data-role="page"&gt;
        &lt;div data-role="header" data-position="fixed"&gt;
          &lt;h1&gt;JQuery Error&lt;/h1&gt;
          &lt;a href="/" data-icon="home"&gt;Home&lt;/a&gt;
          &lt;a href="/" data-icon="delete"&gt;Logout&lt;/a&gt;
        &lt;/div&gt;&lt;!-- /header --&gt;
  
        &lt;div data-role="content"&gt;
          &lt;h1&gt;Go to /redirect_to &lt;a href="/redirect_to"&gt;here&lt;/a&gt;.
        &lt;/div&gt;&lt;!-- /content --&gt;
  
        &lt;div data-role="footer" data-position="fixed"&gt;
          &lt;h1&gt;Footer&lt;/h1&gt;
        &lt;/div&gt;&lt;!-- /footer --&gt;
      &lt;/div&gt;&lt;!-- /page --&gt;
    &lt;/body&gt;
  &lt;/html&gt;
    end_page
  end
  
  get '/redirect_to' do
    &lt;&lt;-end_page
  &lt;!DOCTYPE html&gt; 
  &lt;html&gt; 
    &lt;head&gt; 
      &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" /&gt;
      &lt;script src="http://code.jquery.com/jquery-1.6.1.min.js"&gt;&lt;/script&gt;
      &lt;script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div data-role="page"&gt;
        &lt;div data-role="header" data-position="fixed"&gt;
          &lt;h1&gt;JQuery Error&lt;/h1&gt;
          &lt;a href="/" data-icon="home"&gt;Home&lt;/a&gt;
          &lt;a href="/" data-icon="delete"&gt;Logout&lt;/a&gt;
        &lt;/div&gt;&lt;!-- /header --&gt;
  
        &lt;div data-role="content"&gt;
          &lt;form action="/redirect_to" method="post" accept-charset="utf-8"&gt;
            &lt;p&gt;&lt;label for="name"&gt;Name&lt;/label&gt;&lt;input type="text" id="name" name="name" value="" id="name" placeholder="input your name"&gt;
            &lt;p&gt;&lt;input type="submit" value="Redirect to /thank_you &amp;rarr;"&gt;&lt;/p&gt;
          &lt;/form&gt;
        &lt;/div&gt;&lt;!-- /content --&gt;
  
        &lt;div data-role="footer" data-position="fixed"&gt;
          &lt;h1&gt;Footer&lt;/h1&gt;
        &lt;/div&gt;&lt;!-- /footer --&gt;
      &lt;/div&gt;&lt;!-- /page --&gt;
    &lt;/body&gt;
  &lt;/html&gt;
    end_page
  end
  
  post '/redirect_to' do
    redirect "/thank_you/#{params[:name]}"
  end
  
  get '/thank_you/:name' do |name|
    &lt;&lt;-end_page
  &lt;!DOCTYPE html&gt; 
  &lt;html&gt; 
    &lt;head&gt; 
      &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" /&gt;
      &lt;script src="http://code.jquery.com/jquery-1.6.1.min.js"&gt;&lt;/script&gt;
      &lt;script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div data-role="page"&gt;
        &lt;div data-role="header" data-position="fixed"&gt;
          &lt;h1&gt;JQuery Error&lt;/h1&gt;
          &lt;a href="/" data-icon="home"&gt;Home&lt;/a&gt;
          &lt;a href="/" data-icon="delete"&gt;Logout&lt;/a&gt;
        &lt;/div&gt;&lt;!-- /header --&gt;
  
        &lt;div data-role="content"&gt;
          &lt;h1&gt;Thanks #{name}!&lt;/h1&gt;
        &lt;/div&gt;&lt;!-- /content --&gt;
  
        &lt;div data-role="footer" data-position="fixed"&gt;
          &lt;h1&gt;Footer&lt;/h1&gt;
        &lt;/div&gt;&lt;!-- /footer --&gt;
      &lt;/div&gt;&lt;!-- /page --&gt;
    &lt;/body&gt;
  &lt;/html&gt;
    end_page
  end
  </code></pre>