du7133 2012-03-09 08:34
浏览 73

Ajax如何将Javascript字符串传递给php

I've been learning Ajax and now I'm wondering how it allows a string from Javascript to be passed to php.

It was said before that the problem with passing Javascript to PHP is that the PHP code gets run first, and then the Javascript gets run. So when Javascript generates a string it's already too late.

Does this mean that Ajax allows PHP code to be run after Javascript?

  • 写回答

4条回答 默认 最新

  • dqy27359 2012-03-09 08:40
    关注

    The php interpreter sitting on the server is basically interprets whatever php script into (usually) HTML page.

    That's why you can never "pass" javascript variable into php as to the interpreter, your javascript is just yet another string, without any special meaning. Your javascript is run by your browser and doesn't even aware that it was being produced by PHP.

    I believe that's what it means by "too late".

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料