Skip to main content
added 31 characters in body
Source Link
suba
  • 1.4k
  • 16
  • 25

I have created simple web application with laravel 5.8. this is my project url http://localhost/test/public/home

web.php

Route::group(['middleware' => ['auth', 'preventBackHistory']], function() {
   Route::get('home', 'HomeController@index')->name('home');
   Route::post('generate_table.data', 'HomeController@generate_table')->name('generate_table.data');
});

I am calling this ajax into home.blade

"ajax": { 
   "url":"{!! route("generate_table.data") !!}",
   "type": "POST",
    "jsonpCallback": 'jsonCallback',
    "dataType": "jsonp"
 }

I haven't any issue with this ajax.it is loading data. If i navigate to http://localhost/test/public/generate_table.data?callback=jsonCallback , i am getting black screen with

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException

No message

If user navigate http://localhost/test/public/generate_table.data?callback=jsonCallback How to navigate back to /home?

.env APP_DEBUG=false

Thank you.

I have created simple web application with laravel 5.8. this is my project url http://localhost/test/public/home

web.php

Route::group(['middleware' => ['auth', 'preventBackHistory']], function() {
   Route::get('home', 'HomeController@index')->name('home');
   Route::post('generate_table.data', 'HomeController@generate_table')->name('generate_table.data');
});

I am calling this ajax into home.blade

"ajax": { 
   "url":"{!! route("generate_table.data") !!}",
   "type": "POST",
    "jsonpCallback": 'jsonCallback',
    "dataType": "jsonp"
 }

I haven't any issue with this ajax.it is loading data. If i navigate to http://localhost/test/public/generate_table.data?callback=jsonCallback , i am getting black screen with

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException

No message

If user navigate http://localhost/test/public/generate_table.data?callback=jsonCallback How to navigate back to /home?

Thank you.

I have created simple web application with laravel 5.8. this is my project url http://localhost/test/public/home

web.php

Route::group(['middleware' => ['auth', 'preventBackHistory']], function() {
   Route::get('home', 'HomeController@index')->name('home');
   Route::post('generate_table.data', 'HomeController@generate_table')->name('generate_table.data');
});

I am calling this ajax into home.blade

"ajax": { 
   "url":"{!! route("generate_table.data") !!}",
   "type": "POST",
    "jsonpCallback": 'jsonCallback',
    "dataType": "jsonp"
 }

I haven't any issue with this ajax.it is loading data. If i navigate to http://localhost/test/public/generate_table.data?callback=jsonCallback , i am getting black screen with

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException

No message

If user navigate http://localhost/test/public/generate_table.data?callback=jsonCallback How to navigate back to /home?

.env APP_DEBUG=false

Thank you.

Source Link
suba
  • 1.4k
  • 16
  • 25

How to avoid user navigate to ajax url in laravel 5.8?

I have created simple web application with laravel 5.8. this is my project url http://localhost/test/public/home

web.php

Route::group(['middleware' => ['auth', 'preventBackHistory']], function() {
   Route::get('home', 'HomeController@index')->name('home');
   Route::post('generate_table.data', 'HomeController@generate_table')->name('generate_table.data');
});

I am calling this ajax into home.blade

"ajax": { 
   "url":"{!! route("generate_table.data") !!}",
   "type": "POST",
    "jsonpCallback": 'jsonCallback',
    "dataType": "jsonp"
 }

I haven't any issue with this ajax.it is loading data. If i navigate to http://localhost/test/public/generate_table.data?callback=jsonCallback , i am getting black screen with

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException

No message

If user navigate http://localhost/test/public/generate_table.data?callback=jsonCallback How to navigate back to /home?

Thank you.