Monday, May 22, 2017

Laravel - Redirecting with a link from ajax request

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?



via Leff

Advertisement