jQuery:ajax发布到外部表单并在成功时重定向到响应页面

时间:2016-08-18 18:50:32

标签: jquery ruby-on-rails ajax

我必须通过ajax调用发布到外部登录页面。

如果凭据正确,我该如何重定向到外部响应页?

谢谢!

  $('.customer-login-form').on('submit', function() {
    var $this = $(this);
    if($this.valid()) {
      $.ajax('https://google.com/login',
        {
          data: $this.serialize(),
          type: 'POST',
          dataType: 'script',
          success: function() {
            window.location = 'https://google.com/your-summary';
          }
        }
      );
    }
  });

1 个答案:

答案 0 :(得分:0)

使用document.location

document.location = 'http://stackoverflow.com/questions/39025527/jquery-ajax-post-to-external-form-and-redirect-to-response-page-on-success';
相关问题