Here I am trying to achieve callback function by passing function to another.In below example onclick button calling invoke_reporting first parameter textdata is having some data in text format.
Also passing callback but not getting called.
function invoke_reporting(textdata,callback) {
window.open("http://192.168.17.109/TestCopy_Report1/templates/ct-scan-head");
if (callback && typeof(callback) === "function") {
callback(textdata);
}
}
function callback(finaldata){
alertify("callback function");
document.getElementById("post-data").innerHTML = finaldata;
window.opener.document.getElementById('post-data').value = finaldata;
}
And in the newly opened window I want to assign textdata value into this new opened window textarea.
Here is my HTML Code:
<form id="report">
<div class="form-group">
<label for="post-data">Report Data(Text Format):</label>
<textarea class="form-control" rows="20" id="post-data" name="post-data"></textarea>
</div>
<div class="form-group">
<div class="col-sm-6"><button type="submit" class="btn btn-primary btn-block" name="launch" id="launch" onclick="invoke_reporting(document.getElementById('post-data').value)">Launch</button>
</div>
</div>
</form>
Any help would be appreciated.