0

I'm using

 var preview = function () {           
 $.ajax({
    type: "POST",
    url: myAction.do,
    data: "id=" + myid,
    success: function (response) {  
      // some code
      var x=window.open('', '_blank', 'titlebar=no,scrollbars=yes,menubar=no,height='+height+',width='+width+',resizable=yes,toolbar=no,location=no,location=0,status=no,left='+left+',top='+top+'');
      x.document.open();
      x.focus();
      x.document.write(response);

     return false;
    },
    error: function () {  
        return false;
    },
   });           
 }; 

The response is a whole html page.

As I need javascript/jquery script inside it to be executed, I need to use a different way to write the response in x.document.

EDIT

On Firefox 26.0 and Chrome 32.0.x, I resolved by using

 x.document.close();

after

x.document.write(replace);

Instead, on IE, all the .js included scripts are ignored.

EDIT 2

I resolved with

<body onload="myload()">

and in my jsp I've myload() definition in which I call the scripts.

Sefran2
  • 3,578
  • 13
  • 71
  • 106
  • [Sorry, I didn't mean you should replace the comments with -Infinity](http://stackoverflow.com/questions/21136873/jquery-doesnt-work-after-an-ajax-call-response-in-a-pop-up-window#comment-31808683). – Ram Jan 16 '14 at 16:38
  • @BlackSheep: Sorry, I misunderstood your comment on another question of mine. What's the meaning of -Infinity no comment? – Sefran2 Jan 16 '14 at 16:40
  • I shouldn't have written that, sorry. Regarding your current problem, why not opening a url which reads the ID as a query parameter? That way there is no need to use Ajax. – Ram Jan 16 '14 at 16:52
  • This question appears to be off-topic because it is too localized – shanabus Jan 22 '14 at 15:50

0 Answers0