title: incorrect ajax url to controller function in Laravel framework
body: <p>I want a correct ajax URL this one is not working. I am getting this in the console:</p>
  
  <blockquote>
    <p>GET XHR localhost:8000/Controller/getUnitSellingPrice [HTTP/1.0 404
    Not Found 203ms]</p>
  </blockquote>
  
  <p><strong>create.blade View</strong></p>
  
  <pre><code>C:\Apache24\htdocs\printshopsales\resources\views\sales\create.blade.php
  </code></pre>
  
  <p><strong>Controller</strong> </p>
  
  <pre><code>C:\Apache24\htdocs\printshopsales\app\Http\Controllers\SalesController.php
  </code></pre>
  
  <p>I have tried what is here: </p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/9988634/ajax-call-into-mvc-controller-url-issue">Ajax call Into MVC Controller- Url Issue</a></p>
  </blockquote>
  
  <pre><code>    &lt;script&gt;
          $(document).ready(function() {
              $("#stock_name").on('change', function () {
                  let element = $(this);
                  /*var MyAppUrlSettings = {
                      MyUsefulUrl : '/getUnitSellingPrice'
                  }*/
                  $.ajax({
                      //url: MyAppUrlSettings.MyUsefulUrl,
                      url: '/Controller/getUnitSellingPrice',
                      method: 'GET',
                      data: {
                          'stock_name' : element.val(),
                      },
                      success: function (response) {
                          $("#unit_selling_price").val(response.data).trigger('change');
                          console.log(response.data);
                      },
                  });
              });
          });
      &lt;/script&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/205L1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/205L1.png" alt="enter image description here"></a></p>