20

One of the pages in my application has a set of links that when clicked, posts form data based on the TableTools jQuery plugin. I'd like this new page to open up in a new window. Any ideas on the best way to do this? I'd rather not change all of my action links over to individual forms and use target="_blank". I've tried calling a new window to open on success, and posting writing the data to this page, but that hasn't been working. Please help!

HTML:

<div id="action">                        
    Download
</div>   

Javascript:

$('#action').click( function () { 

    var userData = oTable.fnGetColumnData(0);

    $.ajax({
        type: "POST", 
        url: "../download.php",
        data: "user_list=" + userData,
        dataType: "json",
        success: function(data){
            var win = window.open();
            win.document.write(data);
        }
    })  

})
Akhil Aravind
  • 5,741
  • 16
  • 35
Michael
  • 2,276
  • 15
  • 49
  • 80

1 Answers1

12

Found the answer:

jQuery.ajax success callback function not executed

When I took out the dataType: "json", it worked!

Community
  • 1
  • 1
Michael
  • 2,276
  • 15
  • 49
  • 80