0

i create ajax call to get data. and in success function i add window.open(), without onclick event the result of window open is incorrect. the result is window open as tab not new window. i have add name in window.open(). and the url is incorrect.

$.ajax({
data: "ticket="+invoice,
type: "POST",
url: "<?php echo base_url('controller');?>",
cache: false,
dataType:"json",
success: function(response) {
    window.open(url,windowName);
} });

url in address bar of tab is controller_url "url,windowName" enter image description here

in my case, correct url in address bar is http://localhost/cinema/adm/cahier/ticket/kode_ticket it normal if i call window.open() in onclick event. what i want is open new window popup automatically after ajax success

Dedi Ananto
  • 144
  • 2
  • 14

1 Answers1

0

When you're calling the window.open method you may specify the window width and height, or other parameters and it shall open a new window, which you would specify more than likely the current window size, or something that works for you.

Like so;

window.open(url, windowName, "height:500,width:300")

http://www.w3schools.com/jsref/met_win_open.asp

Aaron Young
  • 16
  • 1
  • 2