Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork69
Fix Ajax error of URL too long#46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ElfSundae commentedNov 28, 2017
BTW, in my opinion, the default |
ElfSundae commentedDec 7, 2017
@yajra What do you think? |
yajra commentedDec 8, 2017
Sorry for late reply, the header method override looks good. Does this mean that we still be using the same route for dataTables and it will not be redirected to store on resource controller? Will try to test this asap. Thanks! |
ElfSundae commentedDec 8, 2017
Yes, no need to change dataTables routes. Just pass Laravel determines request method via |
yajra commentedDec 15, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@ElfSundae this seems to work but needs some modification. IMO, we should not change the /** * Set ajax method to POST, X-HTTP-Method-Override header to GET. * * @param string|array $attributes * @return array */publicfunctionpostAjax($attributes ='') {if (!is_array($attributes)) {$attributes = ['url' => (string)$attributes]; } unset($attributes['method']); Arr::set($attributes,'type','POST'); Arr::set($attributes,'headers.X-HTTP-Method-Override','GET');$this->ajax =$attributes;return$this; } UsersDataTable: publicfunctionhtml() {return$this->builder() ->columns([...]) ->postAjax() ->parameters([...]); } Loved the trick you pulled on method override ❤️ |
| * @return $this | ||
| */ | ||
| publicfunctionajax($attributes ='') | ||
| publicfunctionajax($attributes ='',$post =false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Lets keep theajax function as is and promotepostAjax to public api.
ElfSundae commentedDec 15, 2017
That is what I did in the previous PR#45 , a new A new So we now have three standalone ways to configure Ajax params:
|
ElfSundae commentedDec 15, 2017
Done in#45 |
Uh oh!
There was an error while loading.Please reload this page.
Ref PR#13#45 , issueyajra/laravel-datatables#348
This PR adds a POST option to
ajax()method for Html Builder, to make Ajax request to: sending via POST, handle via GET as usual.Usage:
--Updated --
You can also use
minifiedAjaxat the same time: