0

I have a modal with the quick registration form, and a page with full-registration.

the modal is loaded via an AJAX request with Javascript and contains only the forms, without templates etc:

<script type='text/javascript'>
  $(document).ready(function(){
      $('.ls-modal').on('click', function(e){
      e.preventDefault();
      $('#authmodal').find('.modal-body').load($(this).attr('href'));
      });
  });
  </script>

In the navbar obviously I put:

<a data-modal-toggle="defaultModal" href="{{url('fregister.html')}}" class="ls-modal">

If I click on it, it loads the modal for me correctly, but instead, if one opens the link in a tab, it opens the page for him:

enter image description here

How can I make it so that if one opens the page in a tab it has a different address than the modal address?

example: modal: fregister.html tab: reg.html

LegoLiam
  • 97
  • 3
  • 11

1 Answers1

0

I solved it by adding a control in the controller.

  public function getRegister() {
    if(\Request::ajax()) {
      return view('front.component.elements.register');
    } else {
      return view('auth.fullregister');
    }
  }
LegoLiam
  • 97
  • 3
  • 11