I have a opened window called "http://192.168.17.109/report3_test/post-data" shown below.
Onclick Launch
button I am passing textbox
id and callback
function here is the html and jquery function
HTML
<form id="report">
<div class="form-group">
<center><label for="post-data"><h3>Reporting Data</h3></label></center>
<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'),callback)">Launch</button>
</div>
</div>
</form>
JavaScript
function invoke_reporting(textdata,callback) {
window.open("http://192.168.17.109/report3_test/templates/ct-head");
if (callback && typeof(callback) === "function") {
callback(textdata,newwindow);
}
}
Here I am opening a this new window on click launch and it shown below http://192.168.17.109/report3_test/templates/ct-head
Onclick copy to clipboard button I want to send data back to already opened window shown on top that is "http://192.168.17.109/report3_test/post-data" and here is my callback method .
function callback(finaldata){
var arr = $.parseHTML(finaldata);
v
Window.onload = function(){
var test_data = "";
for(var i=0; i<finaldata.length;i++)
{
if(i == 0){
var first_element = 'REPORT TITLE:' + '<br/>' + finaldata[0] + '<br/>' + '<br/>';
test_data += first_element.replace(/<br.*?>/g, '\n');
}else if(i == 1){
var second_element = 'FINDINGS:' + '<br/>' + finaldata[1] + '<br/>' + '<br/>';
test_data += second_element.replace(/<br.*?>/g, '\n');
}else{
var final_element = 'IMPRESSION:' + '<br/>' + finaldata[2];
test_data += final_element.replace(/<br.*?>/g, '\n');
}
}
newWindow.document.getElementById('post-data').value = test_data;
};
}
Any help would be appreciated.