Reputation: 133428
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?
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.
Upvotes: 1
Views: 2867
Reputation: 1971
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
);
}
Upvotes: 4