[英]How to call a shell script on a click button of java script?
抱歉,如果我问的是一个愚蠢的问题,但老实说,我已经搜索了很多,但没有得到太多信息,所以想把它贴在这里。 所以我有一个 UI(在 apache 上运行,在 html 中),其中有一个按钮,现在我想从那个按钮调用一个 shell 脚本并停止某个服务,你能指导我怎么做吗?
我确实搜索并了解了 node.js,但作为服务器端编程中的傻瓜,我无法做到这一点,如果专家能在这里指导我,我将不胜感激。
if (validate()) { // Preliminary data check to preven unecessary request
$.ajax(
'/path/to/your-script', { // the URL where the php script is hosted
'action': 'update', // variables passed to the server
'id': '123',
'value': 'New Value'
}, function (response) { // server response
if (typeof(response.success) == 'number' && response.success) {
}
}, 'json' // data format
);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.