title: Laravel with Jquery - Ajax Throwing 500 Error - Prob with Server Side
body: <p>. Hello y'all.  I am trying to gather a few variables and send it to my controller. I keep getting a 500 error and can't figure out where exactly I'm going wrong other than I'm pretty sure its server side. Any pointers about where I went wrong or better practices would be greatly appreciated! Thank yall so much! </p>
  
  <p>Route:</p>
  
  <pre><code>/*Ajax Edit Price on Price Page*/
      Route::post('edit_price', array(
          'as'    =&gt; 'edit_price',
          'uses'  =&gt; 'PriceController@edit_price'     
      ));
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public function price_edit(){
  
      console.log($id_and_db);
  
      }
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>/*Ajax edit prices*/
  $(document).ready(function(){
  
          $('.edit_button').click(function(e){
          e.preventDefault();
  
          var id_and_db   = $(this).prop('name').replace('edit', 'newprice'),
          new_price   = $('[name=' + id_and_db + ']').val();
  
          $('#test').val(id_and_db);
  
          $.ajax({
              url: 'edit_price',
              type: "POST",
              data: {
                  "id_and_db": id_and_db,
                  "new_price": new_price,
              },
              success: function(data){
                  $("#edit_results").html(data);
                  $("#edit_results").addClass('panel callout radius');
                  console.log(data);
              },
              error: function(xhr, status, error){
                  console.log(xhr);
                  console.log(status);
                  console.log(error);
              },
          });
      });
  
  });
  </code></pre>
  
  <p>Error Message:</p>
  
  <pre><code>POST http://localhost/local/example/public/edit_price 500 (Internal Server Error) jquery.min.js:4
  XHR finished loading: POST "http://localhost/local/example/public/edit_price". jquery.min.js:4
  Object {readyState: 4, getResponseHeader: function, getAllResponseHeaders: function, setRequestHeader: function, overrideMimeType: function…}
   price_index_admin.js:40
  error price_index_admin.js:41
  Internal Server Error 
  </code></pre>