Pass Value from Jquery Variable to window.open
<p>I have following Jquery code that alerts a value of an HTML field in this variable <code>$(".attachmentsUpload input.file").val());</code></p>

<p>My problem is i want to pass this value to variable val like this </p>

<pre><code>window.open("http://abc.com/crop/test.php?val="+$(".attachmentsUpload input.file").val()),"_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400");
</code></pre>

<p>but its not passing the value.</p>

<pre><code>&lt;script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'&gt;&lt;/script&gt;

      &lt;script type='text/javascript'&gt;//&lt;![CDATA[ 
    $(function(){
    $(".attachmentsUpload input.file").live("change", function () {
        if ($(".attachmentsUpload input.file").val() == "") {
            return;
        }
        // your ajax submit
        alert("submit value of the file input field=" + $(".attachmentsUpload input.file").val());


        $(".attachmentsUpload input.file").replaceWith('&lt;input type="file" class="file" name="file" /&gt;');
    });
    });//]]&gt;  

    window.open("http://abc.com/crop/test.php?val="+$(".attachmentsUpload input.file").val()),"_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400");

    &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;form class="attachmentsUpload" action="/UploadHandler.ashx" method="post" enctype="multipart/form-data"&gt;
    &lt;input type="file" class="file" name="file" /&gt;

&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
