-
-
Save BriceShatzer/8602060 to your computer and use it in GitHub Desktop.
WPD - doc tracking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// - orginal code | |
// worked but triggered pop block and would open in a new window instead of a new tab | |
$('a.docLink').click(function(event) { | |
event.preventDefault(); | |
var documentURL = $(this).attr('href'); | |
$.post (submissionURL, theInfo) | |
.always( function() { | |
var win=window.open(documentURL,'_blank'); | |
win.focus(); | |
}); | |
}); | |
// Found this: http://stackoverflow.com/a/13158856/1608016 | |
// so I changed the code to this: | |
$('a.docLink').click( function(event){ | |
event.preventDefault(); | |
var documentURL = $(this).attr('href'); | |
$.ajax({ | |
url: submissionURL, | |
type: 'POST', | |
data: theInfo, | |
async: false | |
}) | |
.always(function() { | |
var win=window.open(documentURL,'_blank'); | |
win.focus(); | |
}); | |
}); | |
// works as intended (page opens in a new tab, post is sucessful) | |
// why does async: false change the behavior of the new window opening? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment