dskzap8756 2017-05-22 14:32
浏览 186

Laravel - 使用来自ajax请求的链接重定向

I need to redirect users with a link that I should get from an ajax request. What I need is basically just a route for a page:

Route::get('/access', 'SubpagesController@access');

And in that controller I should redirect users to a link that I am supposed to get from the ajax request:

$.ajax({
    url: url ,
    data : { search: 'test' },
    dataType: 'json',

    success : function(json) {

      link = metaArray[0].value;
    }
  })

Since, this will only be a route to which the users will be able to come only if they write the url for it, so there won't be any links on the page for it, I am not able to send any data from the frontend to backend to work with it? I have no idea how can I go about this issue?

  • 写回答

1条回答 默认 最新

  • dongpan9760 2017-05-22 14:44
    关注
    $.ajax({
        url: url ,
        data : { search: 'test' },
        dataType: 'json',
    
        success : function(json) {
    
            window.location = metaArray[0].value;
        }
    })
    

    Just redirect with javascript using window.location.

    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?