如何通过javascript读取cgi文件
如何在 JavaScript 中使用 CGI 程序的输出?
How do I use the output of a CGI program in javascript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如何在 JavaScript 中使用 CGI 程序的输出?
How do I use the output of a CGI program in javascript?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
与阅读任何其他服务器页面的方式相同:AJAX。
Same way you read any other server page: AJAX.
如果您的cgi文件位于Web根目录中,您可以使用Ajax来接收其内容。 jQuery 示例:
If your cgi file is placed inside web root directory, you can use Ajax to receive its content. jQuery sample:
您可以让您的 cgi 以文本形式输出 javascript 命令,然后像包含任何其他 javascript 文件一样包含其输出。
Python 中的 CGI 示例:
然后将其包含在您的 HTML 页面中:
You can have your cgi output javascript commands in text and then include its output as you would include any other javascript file.
CGI Example in Python:
Then include this in your HTML page: