window.open without popup blocker using AJAX and manipulating the [removed]

后端 未结 2 1984
北荒
北荒 2021-01-31 12:23

When dealing with OAuth from the server, such as Twitter and Facebook, you most likely will redirect the user to an URL asking for app permission. Usually, after clicking a link

2条回答
  •  执念已碎
    2021-01-31 12:55

    Try adding async: false. It should be working

    $('#myButton').click(function() {
    $.ajax({
        type: 'POST',
        async: false,
        url: '/echo/json/',
        data: {'json': JSON.stringify({
            url:'http://google.com'})},
        success: function(data) {
            window.open(data.url,'_blank');
        }
    });
    });
    

提交回复
热议问题