【发布时间】:2016-03-25 07:36:11
【问题描述】:
我在将点击的值传递给会话数组时遇到问题。 当我单击“活动”类下方的链接时,因此基于活动链接我想将数据传递给会话。这个想法就像网站:newfuturescareernavigator.org/assessment/step-1/,它在没有表单的情况下分为三页。
<a href="#" data-chng="this is-active" data-id="190">
<a href="#" data-chng="this is-active" data-id="436">
<a href="#" data-chng="this is-active" data-id="430">
这里是我点击链接后,被激活的类is-active。
<a href="#" data-chng="this is-active" data-id="190" class="is-active">
<a href="#" data-chng="this is-active" data-id="436" class="is-active">
提前致谢
【问题讨论】:
-
您是要添加类(在 javascript 中)还是使用 ajax 并将其存储在
$_SESSION(php) 中?你有没有尝试过? -
是的,我正在尝试从选定的链接中获取数据 ID,但我无法使用 ajax。
-
你为什么不能使用ajax,你把它作为你问题的标签?您可以将数组存储在
$_SESSION中。您将从$_GET或$_POST获得数组。您应该编辑您的问题并包含您尝试过的任何代码。如果您不需要在服务器端存储值,您可以使用带有 onclick 事件的 javascript。 -
我的意思是,我不会用ajax,没有那么多经验。
-
您是否尝试使用带有隐藏复选框的标签,然后在下一页获得结果? check this fiddle
标签: javascript php arrays ajax session