Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am trying to open a new window from jquery by writing below code
JavaScript
window.open("pgPdfCreate.aspx?id=" + id + "&col=" + col + "&row=" + row + "&itemtype=" + itemtype + "&catname=" + catname + "&optionselected=" + optionselected + "&orient=" + orientation + "&from=" + from1+"&toemail="+toemail+"&subject="+subject+"¬es="+notes, "PDF Creation", "width=500,height=500");


it works fine and opens a new window but when it gets close the query string is appended to the page url from where this window gets open

so how can i solve this problem?

JavaScript
function PDFCreator() {
var id = $("#Catid").val();
var optionselected = $('input[name=type]:checked').val();
console.log("Selected="+optionselected);
var from1 = $("#from").val();
console.log("FROM="+from1);
var col = "";
var row = "";
var itemtype="";
var catname = "";
var orientation = "";
var toemail=$("#txtEmail").val();
var subject=$("#txtSub").val();
var notes=$("#txtNotes").val();
if (optionselected == "small") {
col = "3";
row = "5";
itemtype = "true";
orientation = "P";
}
else if (optionselected == "medium") {
col = "2";
row = "4";
itemtype = "true";
orientation = "P";
}
else if (optionselected == "large") {
col = "1";
row = "3";
itemtype = "true";
orientation = "P";
}
else if (optionselected == "individual") {
col = "1";
row = "1";
itemtype = "true";
orientation = "P";
}
closeDowloadDiaLog();
window.open("pgPdfCreate.aspx?id=" + id + "&col=" + col + "&row=" + row + "&itemtype=" + itemtype + "&catname=" + catname + "&optionselected=" + optionselected + "&orient=" + orientation + "&from=" + from1+"&toemail="+toemail+"&subject="+subject+"¬es="+notes, "PDF Creation", "width=500,height=500");
}
Posted
Updated 17-May-15 23:28pm
v2
Comments
deepankarbhatnagar 16-May-15 3:19am    
please provide the whole code , just to clarify whether you put this code on page load or not ie inside $(document).ready()
bhavikadb 16-May-15 3:21am    
function PDFCreator() {
var id = $("#Catid").val();
var optionselected = $('input[name=type]:checked').val();
console.log("Selected="+optionselected);
var from1 = $("#from").val();
console.log("FROM="+from1);
var col = "";
var row = "";
var itemtype="";
var catname = "";
var orientation = "";
var toemail=$("#txtEmail").val();
var subject=$("#txtSub").val();
var notes=$("#txtNotes").val();
if (optionselected == "small") {
col = "3";
row = "5";
itemtype = "true";
orientation = "P";
}
else if (optionselected == "medium") {
col = "2";
row = "4";
itemtype = "true";
orientation = "P";
}
else if (optionselected == "large") {
col = "1";
row = "3";
itemtype = "true";
orientation = "P";
}
else if (optionselected == "individual") {
col = "1";
row = "1";
itemtype = "true";
orientation = "P";
}
closeDowloadDiaLog();
window.open("pgPdfCreate.aspx?id=" + id + "&col=" + col + "&row=" + row + "&itemtype=" + itemtype + "&catname=" + catname + "&optionselected=" + optionselected + "&orient=" + orientation + "&from=" + from1+"&toemail="+toemail+"&subject="+subject+"¬es="+notes, "PDF Creation", "width=500,height=500");
}
deepankarbhatnagar 16-May-15 3:23am    
And how/where do you call PDFCreator()?
bhavikadb 16-May-15 3:24am    
from a popup window on pgHome.aspx there is a button which calls this jquery function
Sinisa Hajnal 17-May-15 12:37pm    
Please move the code into the question, I almost didn't see it.

Also, window.open is javascript not jQuery.

As for the problem, have you tried a) reseting query string before closing the dialog OR saving the original URL before opening the dialog and restoring it after the closing of the same?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900