How to ajax render view with data in Laravel ?

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Today now in this post we know about Laravel ajax render view with data. Sometimes, we are use get html view layout from the ajax request. On that we have to need first render view file and then we need to store view in a variable and then we will return that variable. Now in bellow example i will render view also with pass data.

you can see that how i did on the bellow example:

Example:
$data = $this->semester->getSemesterName($input);
$type = "Subject";
$options = view("home.ajax",compact('data','type'))->render();
return $options;

Read Also: Generate Captcha code and Validation by using BotDetect package in laravel

Thanks for read. I hope it help you. For more you can follow us onĀ facebook.

About code chef

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by code chef →