大佬教程收集整理的这篇文章主要介绍了jquery-mobile – JQuery Mobile中的重定向错误,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
说我有三个资源:
/ => 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!"
之后我得到谢谢!页面,如果我尝试回家,然后去/ redirect_to我得到/ thank_you的内容,而不是/ redirect_to的形式,如果我刷新页面我得到的表单。
这是Sinatra中的代码,如果你不明白,在这一点上,我将重写它在Flask,Snap,Rails,Django(我的应用程序在Django)…但它应该是足够好阅读。这是Github上的代码(由于StackOverflow没有检测到我的红宝石):https://gist.github.com/1061639
要运行该应用程序,您基本上安装了sinatra:gem install sinatra
并运行它:./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">@L_673_15@ut</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">@L_673_15@ut</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 →"></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">@L_673_15@ut</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
<div data-role="page" data-url="/thank_you">
我发现从Redirects and linking to directories下的文档的信息。
以上是大佬教程为你收集整理的jquery-mobile – JQuery Mobile中的重定向错误全部内容,希望文章能够帮你解决jquery-mobile – JQuery Mobile中的重定向错误所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。