Need to execute a shell script / python script that can execute shell commands from Angular JS UI

479 views
Skip to first unread message

Yash Kashyap

unread,
May 8, 2020, 1:53:03 PM5/8/20
to Angular and AngularJS discussion
Hi Everyone,

I want to execute a script by clicking a HTML button that contains some shell commands. So far I 've done this,
```
<input type="button" id='script' name="scriptbutton" value=" Run Script " onclick="goPython()">

<script src="http://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script>
function goPython(){
$.ajax({
type: 'GET',
url: 'script.py',
dataType:'script',
success: function(data){
alert(data);
console.log('success',data);
}
});
</script>
```
But this is just showing me the contents of the file rather than executing it. Can you guys tell me how can I execute this script by clicking the button.
I googled, the answer I got was to send a $http request to the script.py and set up a listener on my python script. But I'm not sure how to achieve that.

Manjari Singh

unread,
May 8, 2020, 1:55:35 PM5/8/20
to ang...@googlegroups.com
I think observable 

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/10940548-b268-4ef8-84e5-130124dd8b35%40googlegroups.com.
--
Sent from Gmail Mobile
Reply all
Reply to author
Forward
0 new messages