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
My Route file :
Route::get("a/b","AController@c");
My js file :
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){
});
Suppose I am in following urls:
domain.com/dev/lar/public/index.php/c/d
Then I call this ajax , then url will redirect to
domain.com/dev/lar/public/index.php/c/public/index.php/a/b
Here lar is my laravel app folder
** Note I am using NGINX server. My Server Admin do not rewrite this url. That's why I use public/index.php **