dqol6556 2017-08-26 10:15
浏览 47
已采纳

如何用php触发JavaScript函数[关闭]

Ok so I have a PHP document wich saves the contents of a text input how do I trigger a function in a .js file when it's done . I've done the part with the uploading I just can't figure out how to trigger the js function

  • 写回答

2条回答 默认 最新

  • douqiao5552 2017-08-26 11:14
    关注

    You can simply do this:

    echo "<script src='myScript.js' type ='text/javascript'> myFunction(); </script>";
    

    Im not exactly sure what functionality you're trying to get working but if this is supposed to be some kind of data controller where you simply process data, calling echo may give the user a blank screen, so you will want to redirect the user like so

    header('Location: redirectLocation');
    

    Do try to provide more details in future questions, but i hope this answered your question.

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

报告相同问题?

悬赏问题

  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?