I need a solution for on click button call PHP function in the same PHP file, PHP function internally executes a Perl script as well as downloads a file using ftp. (my Perl script is executing and my ftp download works fine) only when I click button it's not calling PHP function). I found many other posting didn't find the solution which I am looking. Is there anything I am doing wrong?
Thank you in advance
below is my sample PHP code
<?php
function getFile(){
exec("/../myperlscript.pl parameters");//
//some code for ftp file download( which is working )
}
<!--
if(isset($_POST['submit'])){
getFile();
}
-->
?>
<script src="https://code.jquery.com/jquery-1.11.2.min.js">
</script>
<script type="text/javascript">
$("form").submit(function() {
$.ajax({
type: "POST",
sucess: getFile
});
});
</script>
<form method="post">
<input type="button" name="getFile" value="getFile">
</form>