dongmaoxi0477 2010-01-18 04:27
浏览 47
已采纳

Jquery .post用于存储php会话变量。 如何避免刷新以调用会话值

I am using jquery's .post ajax call to pull an form input value and pass it to a php file that starts a session and stores the value in it. The session value is then called on a different page.

The problem is, this all takes place without a page refresh, so the session value is always one page refresh behind. I.E. the first time the session value is called it is blank, but after refresh the value is loaded with the initial input value. When refreshing again, the session's second value is pulled. So, the session value is never current... it is one behind.

How can make it so the php session variable is current without needing to do a refresh?

Or, if this needs to be solved with a refresh, what is the best way to go about it?

Thanks for your help!

  • 写回答

3条回答 默认 最新

  • dongzun9958 2010-01-26 15:51
    关注

    I did not end up needing to use Sessions, or Cookies.

    I found a solution to my problem here:

    http://simple.procoding.net/2008/03/21/how-to-access-iframe-in-jquery/

    The issue was my input that the variable needed to be passed to was on a different page. Because I loaded this page with an iframe, I could carry the variable to the input with jQuery without the need for php sessions or php cookies. I used the technique that is in the linked post above.

    Thanks to everyone who helped out.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码