【问题标题】:jquery mobile query string parametersjquery mobile查询字符串参数
【发布时间】:2013-01-17 21:27:29
【问题描述】:

在我的应用程序中,我有 perl 的后端代码和使用 jquery mobile 的前端开发。当我在 jqm 页面上使用变量 x=10 y=20 提交表单时,在查询字符串中而不是替换 jqm.com/?x=10&y=20 之类的参数,我将其附加为 jqm.com/id=1000&x=10&y=20。我再次更改我的值并提交我得到的表单
jqm.com/?id=1000&x=10&y=20&id=1000&x=newvalue&y=newvalue

【问题讨论】:

  • 你的表单的作用是什么?

标签: forms jquery-mobile mobile query-string


【解决方案1】:

您遇到此问题是因为您没有在表单中指定action 属性。因此,默认情况下,它会将数据发送到页面本身,因此您每次都会将参数附加到当前页面 url。

要解决此问题,只需添加action 属性,如下例所示:

<form action="a-page-to-send.php" method="post">
  <!-- code goes here -->
</form>

【讨论】:

  • 我知道我将它发送给我自己...我不需要将它们发送到其他页面。
  • 好。在这种情况下,让您的页面称为“page.php”,只需设置 action="page.php"
  • 在这种情况下,它可能取决于您尚未发布的其他代码
猜你喜欢
  • 1970-01-01
  • 2013-07-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-21
  • 2011-04-03
  • 2020-11-09
相关资源
最近更新 更多