tags:

views:

25

answers:

0

Hi,

I'm tweaking an existing open source tool...

Its current js code has the following line, that opens up a new window to dump output, and the user takes an action or not.

var win = window.open(...);

What I'd like to do is to redirect the var win ... part so that it would send the {data} via a FORM element and let a web server script to process it,

My following attempt failed without error

// var data is known

// page that calls/includes the js code has a FORM with a field
// named 'workspace'

win = function() 
{
  document.forms[0].getElementById('workspace').value='+data+';
  document.forms[0].action = "serverSideScript2processData";
  document.forms[0].method = "post";
  document.forms[0].submit();

}

Also, the current javascript uses jquery.

How to do it?

Thanks.