Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing a CGI script via javascript

Tags:

javascript

cgi

How can I make a cgi script be executed when a javascript function is called? Currently I am using a small iframe and loading the cgi script there, but it does not seem to be working. here is a snippet of code:

function back()
{
    document.getElementById("hidden").src="scripts/backImage.cgi";//execute background script
    document.getElementById("scan").src="scripts/getImage.cgi";//reload the display iframe
}
like image 350
Jakob Weisblat Avatar asked Jan 18 '23 17:01

Jakob Weisblat


2 Answers

You can use XMLHttpRequest to trigger access to your cgi script.

like image 172
Michael Krelin - hacker Avatar answered Jan 31 '23 03:01

Michael Krelin - hacker


You can use jQuery.ajax, or the shorthand:

jQuery.get("scripts/backImage.cgi");
like image 26
Douglas Avatar answered Jan 31 '23 02:01

Douglas