How to redirect through 'POST' method using Javascript?

前端 未结 11 1114
说谎
说谎 2020-12-05 10:05

I\'ve queried and doesn\'t work out what I\'ve found. Is there any way to redirect to give url with POST method using Javascript or jquery?

11条回答
  •  眼角桃花
    2020-12-05 10:24

    Redirect with POST vars (on jQuery)

    var redirect = 'http://www.website.com/page?id=23231';
    $.redirectPost(redirect, {x: 'example', y: 'abc'});
    
    $.extend(
    {
        redirectPost: function(location, args)
        {
            var form = '';
            $.each( args, function( key, value ) {
                form += '';
            });
            $('
    '+form+'
    ').submit(); } });

提交回复
热议问题