-1

Sorry about the relatively vague title, I can't think of anything better.

Anyway, so I have a page that shows a camera feed and I want to control pan/tilt. I've a python cgi that controls the actual nuts and bolts of that and spits out the html, the image being updated by javascript, and is looking for ?action=(left|right|up|down). I'm trapping key presses for that bit, but I can't figure out how to trigger a GET to the cgi without reloading the whole page. Is there any way I can do this or will I just have to reload the page?

Thanks

4

1 回答 1

3

使用ajax 获取..

尝试这个

 $.get('path/to/cgi',{data:"test"},function(data){
    alert("done");
 })

第一个选项是 url..您需要将数据发送到的路径。
第二个参数(可选)是您需要发送到 cgi 的数据对象,
第三个(可选)是成功回调函数,当您从 cgi 成功获得响应时调用该函数

您可以通过 GET 方法获取 cgi 中的数据

于 2013-04-08T14:58:04.570 回答