[英]How to call a shell script on a click button of java script?
Apologies if I am asking a dummy question but honestly I had searched this a lot but not getting much information so thought to post it here.抱歉,如果我问的是一个愚蠢的问题,但老实说,我已经搜索了很多,但没有得到太多信息,所以想把它贴在这里。 So I have a UI(running on apache, in html) where have a button, now from that button I want to call a shell script and stop a certain service, could you please guide me how to do it?所以我有一个 UI(在 apache 上运行,在 html 中),其中有一个按钮,现在我想从那个按钮调用一个 shell 脚本并停止某个服务,你能指导我怎么做吗?
I do searched and got to know about node.js but as a DUMMY in server side programming I am not able to do this, will be grateful to you if experts could guide me here.我确实搜索并了解了 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.