doulutian4843 2016-03-03 07:05
浏览 38
已采纳

如何在包含javascript确认框的变量中保存echo语句?

I have following code

echo '<script type="text/javascript">confirm("Are You Ready To Restore ?");</script>';

Now a confirm box will appears as follows: enter image description here

So when user click on ok the process will continue otherwise it will stop further processing as it cancel it. I want to apply if condition on OK and cancel button . How to save this echo result in variable so that i can apply if condition on it .

  • 写回答

2条回答 默认 最新

  • dongzanghong4379 2016-03-03 07:14
    关注

    How to save this echo result in variable so that i can apply if condition on it .

    You can't do that in one http request. You can put Javascript code in your PHP variables, display it but your PHP code will not get the answer to javascript prompt unless you initiate another request, usually via ajax. Or you can take that conditional code to Javascript completely.

    PHP is already asleep by the time JavaScript stats working.

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

报告相同问题?

悬赏问题

  • ¥15 前台报错,加我微信帮我解决一下,15043457399
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题