title: Laravel 5.7 - AJAX post to DB not refreshing results in main page
body: <p>I am trying to get my AJAX to update the contents of my html after I submit my form. My form submits correctly, the data get's saved to the DB and it WILL display on my page if I refresh the page manually. I am using Laravel 5.7 and PHP 7.3.</p>
  
  <p>What I want is when I submit my note, it saves to DB, and after I save the note the html part that displays my note should update with the content I just saved.</p>
  
  <p>I will let you know I am very new to AJAX, and while I don't think its complicated its obviously something I need to learn more.</p>
  
  <p>JQ:    </p>
  
  <pre><code>$(function() {
      $.ajaxSetup({
        headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
      });
  
      $("#addPatientNote").submit(function(e){                 
          e.preventDefault();
          var patient_id = $('input[name=patient_id]').val();
          var note = $('textarea#note').val();
          $('#addPatientNoteModal').modal('hide');
  
          $.ajax({
              method: "POST",
              url: "/patientnotes",
              data: {patient_id: patient_id, note: note, time: time},
              success: function(data){
                console.log('Post Success '+ data.id);
                refreshNote();
              },
              error: function(data, textStatus, errorThrown) {
                  console.log("AJAX errorjqXHR: " + textStatus + ' : ' +
              errorThrown + ' : ' + data);
  
               }
          });
        });
      });
  </code></pre>
  
  <p>Partial View:</p>
  
  <pre><code>&lt;div class="d-flex w-100 justify-content-between"&gt;
          &lt;h5&gt;&lt;/h5&gt;
          &lt;small&gt;Date: &lt;span id="posted"&gt;&lt;/span&gt;&lt;/small&gt;
      &lt;/div&gt;
      &lt;p class="lead" id="patient_note"&gt;&lt;/p&gt;
      &lt;small&gt;By &lt;span id="firstname"&gt;&lt;/span&gt; &lt;span id="lastname"&gt;&lt;/span&gt; 
      &lt;/small&gt;
  </code></pre>
  
  <p>Now on the main page, I also have this...  I added the refreshNote() to see if that would help, it doesn't lol I am pretty sure I am doing all of this incorrectly...
  JQ:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(function() {
          refreshNote();
      });
  
      function refreshNote(){
          $.ajax({
              method: 'GET',
              url: "/patientnotes/" + {{ $patient-&gt;id }},
              success: function(data){                
                  var posted = moment(data.created_at).format("MM/DD/YYYY, h:mm:ss a");
                  var updated = moment(data.updated_at).format("MM/DD/YYYY, h:mm:ss a");
                  $('#patient_note').html(data.note);
                  $('#firstname').html(data.first_name);
                  $('#lastname').html(data.last_name);
                  $('#posted').html(posted);
                  $('#updated_by').html(data.updated_by);
                  $('#updated_at').html(updated);
                  console.log('Success '+ data.note);
              }           
          });
  }
  </code></pre>