Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to return with open model popup in laravel

//pass back a variable when redirecting
return Redirect::back()->with('error_code', 5);

//in blade tempalte
@if(!empty(Session::get('error_code')) && Session::get('error_code') == 5)
<script>
$(function() {
    $('#myModal').modal('show');
});
</script>
@endif
  
//second seneario use like this
  <script type="text/javascript">
    @if(!empty(Session::get('error_code')))
        <?php $a = Session::get('error_code'); ?>
        $('#updateCarModel{{ $a }}').modal('show');
        console.log("#updateCarModel{{ $a }}");
    @endif
</script>
//@sujay
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #return #open #model #popup #laravel
ADD COMMENT
Topic
Name
7+5 =