I want to do XMLHttpRequest and then open a PDF in the Browser by sending the filename by POST method.
xmlhttp.open(\"POST\",\"pdf.php\",true); //CHANGE
If you're opening the PDF in the same window there's no point in using an XmlHttpRequest, just set window.location (window.location.assign("http://example.com/location/file.pdf")
, window.location.href="http://etc
) from your javascript, instead of invoking XmlHttpRequest.
(if you've received the PDF bytes from the XmlHttpRequest how are you going to convince the browser to display it with PdfPluginX anyway?)
If you want the PDF in a new browser window just use window.open(...)
directly from your javascript.