title: Laravel Ajax call url to controller
body: <p>I am new in laravel. I want to create an api using laravel using ajax call. But I request ajax call,url shows invalid server path.
  Here is my code<br>
  My Route file :</p>
  
  <pre><code>Route::get("a/b","AController@c");
  </code></pre>
  
  <p>My js file :</p>
  
  <pre><code>var base = "public/index.php";
  var url = base + "a/b";
  $.ajax({
    url : url,
    dataType: "json",
    timeout: 10000,
    error:function(){  alert("Error getting from server") }
  }).done(function(resp){
  
  });
  </code></pre>
  
  <p>Suppose I am in following urls:</p>
  
  <pre><code>domain.com/dev/lar/public/index.php/c/d
  </code></pre>
  
  <p>Then I call this ajax , then url will redirect to</p>
  
  <pre><code>domain.com/dev/lar/public/index.php/c/public/index.php/a/b
  </code></pre>
  
  <p>Here lar is my laravel app folder</p>
  
  <pre><code>** Note I am using NGINX server. My Server Admin do not rewrite this url. That's why I use public/index.php **
  </code></pre>