Ajax GET parameters not populated on Nginx -
i on laravel project works locally (get, post requests on forms ajax). hard part when deploy on nginx, works except ajax calls. don't have parameters passed controllers. have like
$.ajax({ type: 'get', url: '{{route(' test.route ') }}', data: { valuepassed: 5 }, success: function(data) { alert(data); } })
with controller returning value passed return input::get('valuepassed')
or return $request->valuepassed
. value when running locally when on nginx param empty. here config :
server { listen 80; listen [::]:80; root /var/www/html/mydomain/public; index index.php index.html index.htm index.nginx-debian.html; server_name mydomain.com www.mydomain.com; location / { try_files $uri $uri/ /index.php?query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.1-fpm.sock; }
ps: i'm kinda new nginx
you seems have typo in config. below
try_files $uri $uri/ /index.php?query_string;
should be
try_files $uri $uri/ /index.php?$query_string;
you passing fixed param instead of 1 client. changing query_string
$query_string
should fix it
Comments
Post a Comment