title: Display the data I get from ajax on view
body: <p>This is the modal where I want to display the value I get from ajax data but it's not working. I have the <code>id="view_name"</code> on span element. I don't know what the problem is it won't display</p>
  
  <p>This is the code that triggers the <code>fun_view</code> function:</p>
  
  <pre><code>&lt;td&gt;
      &lt;a href="" data-id="" class="display" data-toggle="modal" data-target="#myModal" onclick="fun_view('{{ $dat-&gt;id }},{{ $dat-&gt;name }},{{ $dat-&gt;company_name }}, {{ $dat-&gt;mobile_phone }}, {{ $dat-&gt;timezone }}, {{ $dat-&gt;best_time_to_call }}')"&gt;&lt;?php echo $dat-&gt;name;?&gt;&lt;/a&gt;
  &lt;/td&gt;
  
  &lt;div class="modal-body"&gt;         
      &lt;p&gt;&lt;b&gt;Name : &lt;/b&gt;&lt;span id="view_name" class="text-success"&gt;&lt;/span&gt;&lt;/p&gt;
      &lt;p&gt;&lt;b&gt;Company Name : &lt;/b&gt;&lt;span id="view_company_name" class="text-success"&gt;&lt;/span&gt;&lt;/p&gt;
      &lt;p&gt;&lt;b&gt;Mobile Phone : &lt;/b&gt;&lt;span id="view_mobile" class="text-success"&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;script&gt;        
  function fun_view(id,name,company_name,mobile_phone,timezone,best_time_to_call)
  {
      var view_url = $("#hidden_view").val();
  
      $.ajax({
          url: view_url,
          type:"GET", 
          data:
          {
              "id": id,
              "name": name,
              "company_name": company_name,
              "mobile_phone": mobile_phone,
              "timezone": timezone,
              "best_time_to_call": best_time_to_call
          },
          success: function(result){
            //when I alert(result.name) it says undefined
            $("#view_name").text(result.name);
            $("#view_company_name").text(result.company_name);
            $("#view_mobile").text(result.mobile_phone);
          }
      });
  }
  &lt;/script&gt;
  </code></pre>