title: AJAX and Laravel - load data dynamically on modal "Unexpected identifier"
body: <p>I'm am trying to load data dynamically on bootstrap modal with ajax, but I can not put it to work ye. I've done some research and I've seen some videos and still I can not do it. I hope someone can help me</p>
  
  <pre><code>                  &lt;ul&gt;
                    @foreach ($rs as $r)
                      &lt;li&gt;&lt;button class="viewData" value="view" id="{{$r-&gt;id}}"&gt;{{$r-&gt;title}}&lt;/button&gt;&lt;/li&gt;
                    @endforeach
                    &lt;/ul&gt;
  </code></pre>
  
  <p>this is my items</p>
  
  <pre><code>  &lt;div class="portfolio-modal modal fade" id="projectView" role="dialog" tabindex="-1" aria-hidden="true"&gt;
                &lt;div class="modal-dialog"&gt;
                  &lt;div class="modal-content" id="modal-content"&gt;
                    &lt;div class="close-modal" data-dismiss="modal" data-remodal-action="close"&gt;
                        &lt;div class="lr"&gt;
                            &lt;div class="rl"&gt;
                            &lt;/div&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                        &lt;div class="row"&gt;
                          &lt;div class="col-lg-12"&gt;
                            &lt;div class="modal-body" id="project-content"&gt;
                              &lt;!-- CONTENT HERE --&gt;
                            &lt;/div&gt;
                          &lt;/div&gt;
                       &lt;/div&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>this is my modal where I want to show my item on detail</p>
  
  <p><strong>UPDATE:</strong>
  I updated my js file and now I am trying to print the contents of my object in the modal but it giving me this error "Unexpected identifier"</p>
  
  <pre><code> $(document).ready(function(){
  
      $.ajaxSetup({
        headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
      });
  
  
     $('.viewData').click(function(){
       var project_id = $(this).attr("id");
  
  
       $.ajax({
     url:"/data",
     method:"POST",
     data:{'project_id' : project_id},
  
     success:function(data){
       var htmlString = "";
  
       htmlString += "&lt;h3 class="text-center"&gt;" + data.title + "&lt;/h3&gt;";
  
       $('#project-content').html(htmlString);
       console.log(data);
       $('#projectView').modal("show");
     }
   });
  
     });
  
  });
  </code></pre>
  
  <p>this is my js file where I pass the item id</p>
  
  <pre><code>  public function dataToModal(Request $request) {
  
    if(!empty($request)){
      $id = $request-&gt;project_id;
      $project = content::FindOrFail($id);
  
      return  Response::json($project);
  
   } else {
    return 'asa';
  }
  
  }
  </code></pre>
  
  <p>This is just a project I created to test this functionality, when it is working I will implement it on the main site. Someone can help me? Any help and suggestions are welcome!</p>
  
  <p>Thank you in advance.  </p>