I have a hyperlinked image, clicking on image should call a javascript function named downloadReport()
as given below,
<a href="#" title="Export" target="self"><img onclick="downloadReport()" align="right" id="exportFile" src='<c:url value="resources/img/excel_download.jpg"/>'></a>
again this function contains two more functions within it.
function downloadReport() {
upload();
download();
}
function upload(){
from = getFrom();
to =getTo();
all = getAll();
approved =getApproved();
rejected = getRejected();
pending = getPending();
_("multiphase").method = "get";
_("multiphase").action = "/curation/export";
_("multiphase").submit();
}
function download(){
_("multiphase").method = "get";
_("multiphase").action = "/curation/download";
_("multiphase").submit();
}
Issue with this code is that, second function download() is getting called prior to upload, how to wait to complete upload function and then call download function? since i am beginner to javascript and doesn't have much information about Ajax or JQuery too.