I have a doubt (classic-asp server).
This script:
<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
function executeCommands()
{
var WshShell = new ActiveXObject("WScript.Shell");
var sFTP = 'ftp.exe -s:\\\\aServerNas.intranet.blalba\\scossa$\\\\ftp\\<%=CODEID%>.ftp';
var oExec = WshShell.run(sFTP , 2);
};
</SCRIPT>
allow me to run the ftp script in a side-client (my pc) command shell when I click on id=reload tag:
$('#reload').click(function(){
executeCommands();
}
});
But if I change the script adding attribute "runat":
<SCRIPT type="text/javascript" LANGUAGE="JavaScript" runat="server">
function executeCommands()
{
var WshShell = new ActiveXObject("WScript.Shell");
var sFTP = 'ftp.exe -s:\\\\aServerNas.intranet.blalba\\scossa$\\\\ftp\\<%=CODEID%>.ftp';
var oExec = WshShell.run(sFTP , 2);
};
</SCRIPT>
the command-shell, when I click on id=reload tag, will be executed on the server (\\aServerNas), which is what I need?
Thank you a lot and I apologize for my bad english.
Edit: the question is: How I can run FTp if client-side havn't access to \aServerNas (that is the server where the .ftp script is)?
$('#reload').click(function(){...code still on the client side, because if it is it won't be able to see the server side function. Server side code is executed on the server (as the name suggests) and runs as the page is loading. Rather than trying to call a function you would probably be better off putting your code inside a conditional statement which is triggered by a form submission or a querystring value.