简体   繁体   English

从JavaScript发送HTTP请求(并处理回复)

[英]Sending HTTP requests from JavaScript (and handling the reply)

I'm fairly new to both HTTP and JS. 我对HTTP和JS都是新手。

I want to display the video (and audio) feed from an IP-based web cam. 我想显示基于IP的网络摄像头的视频(和音频)提要。 It has an HTTP based AOP, which accepts requests like 它具有基于HTTP的AOP,可以接受类似

http://<ip-address>/cgi/audio/receive.cgi?[&<argument>=<value>] 

and returns HTTP 200 or HTTP 400, etc 并返回HTTP 200或HTTP 400等

Basically I want to remotely control just about everything about the camera using this sort of interface (volume, zoom, image size, frame per second, etc, etc) 基本上,我想使用这种界面远程控制相机的几乎所有内容(音量,缩放,图像大小,每秒帧数等)。

How do I go about sending the HTPP request (when the user clicks a button on the web page) and checking the response? 如何发送HTPP请求(当用户单击网页上的按钮时)并检查响应?

Can I do it in plain JS? 我可以用普通JS做到吗? Or do I need to use somethign like JQuery? 还是我需要使用诸如JQuery之类的工具?

听起来好像可以使用jQuery.get轻松jQuery.get

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM