简体   繁体   English

jQuery Mobile:传递参数

[英]Jquery Mobile: Passing Parameters

I'm experimenting with JQuery Mobile by making a basic mobile app, but I've ran into an issue with passing parameters to other pages, be they separate HTML files or additional data-content:pages on the original file. 我正在通过制作一个基本的移动应用程序来试验JQuery Mobile,但是在将参数传递到其他页面时遇到了问题,因为它们将HTML文件分开或将原始文件上的其他data-content:pages分开。

All I want to do is select a username from a drop down list, press a button, then proceed to the next page, placing the username in the header (eg Logged in as: Username). 我要做的就是从下拉列表中选择一个用户名,按一个按钮,然后进入下一页,将用户名放在标题中(例如,登录为:用户名)。 I've looked into multiple solutions, such as sessionStorage, PHP sessions, POST/GET from form submission, and none of them seem to work. 我研究了多种解决方案,例如sessionStorage,PHP会话,表单提交中的POST / GET,它们似乎都不起作用。

The closest I've got to what I want is submitting the username via POST through a form, then saving it as a PHP session variable, which displays the username on the next page, but when I navigate to another page it once again fails to display. 我最想要的是通过表单通过POST提交用户名,然后将其保存为PHP会话变量,该变量在下一页上显示用户名,但是当我导航到另一页时,它再次无法显示。

What is the simplest way to pass a parameter forward? 传递参数最简单的方法是什么? I have a suspicion that it doesn't work on the additional pages due to JQuery Mobile's loading method excluding the session_start() from the header... 我怀疑由于JQuery Mobile的加载方法从标题中排除了session_start(),因此无法在其他页面上使用...

I also have problem with php $_SESSION in jquerymobile, here i have 4 pages 我在jquerymobile中也有php $_SESSION的问题,这里我有4页

  1. submit form, save in session 提交表格,保存在会议中
  2. start session, display correctly, click on link 开始会话,正确显示,单击链接
  3. start session, nothing to display, click on link 开始会话,无任何显示,单击链接
  4. start session, nothing to display 开始会话,无显示

but it ALL WORKS with Internet Explorer 10. 但它可以在Internet Explorer 10中正常工作。

I already did some test with my own program, use $_COOKIE instead of $_SESSION . 我已经使用自己的程序进行了一些测试,使用$_COOKIE而不是$_SESSION Now it runs correctly in every browser with jquerymobile 现在,它可以在每个使用jquerymobile的浏览器中正确运行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM