0

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.

RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93

1 Answers1

3
 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
 );
}
sameera lakshitha
  • 1,925
  • 4
  • 21
  • 29
  • 1
    Thank you Sameera for guidance, actually you are right we should use ajex from client(browser) side for this and server side whatever thing we are using should handle it. I have done it by ajex and from server side have used Django and created it successfully, thank you all for your support and help here. LOVE You Stackoverflow – RavinderSingh13 Dec 20 '16 at 15:39