PHP Javascript Change Browser Back Button behaviour Laravel -
i know there various threads ask same none of them seems satisfy needs....
on site, implemeneted search form. simple form input field, called searchquery
, submit button. form sent post method. i'm using laravel btw.. search result loaded view controller. shown in table. comes interesting part: found elements clickable , on page more details element. problem comes: when click browsers button or button on mouse, window asking send form information again , have confirm that.
this not want, want search results had before....
now read lot, still not knowing, how that.
i read before onbeforeunload
can display message, thats not useful me (i want search results)...
so there alternatives possible (if technically possible):
- just prevent dialog asking submit information again , submit again without asking for
- somehow go in history page before (cached maybe or similiar, search results won't change in time)
- if wanted to, include search them in url
http://servername/search/searchquery
, pass searchquery deatil view , have button go url search again or that. (maybe) override browsers button "press" button instead of going in history...
is 1 of these options possible , if yes how? or there other way can advise?
as per comment in question above, can this:
first of form should like:
<form action="/search" method="get"> <input type="text" name="searchquery" value="type keywords here..."> <input type="submit" value="search"> </form>
then after submitting form, route / url this:
http://localhost:8000/search?searchquery=any_search_keyword route::get('search', 'searchcontroller@handlesearch'); // laravel route
and can handle search in controller this:
function handlesearch() { $searchquery = request()->get('searchquery'); // ... handle search here ... }
in way can use method handle searches, prevents unnecessary submission dialog on , on again on going , forth...
as per understanding solution you're looking for
Comments
Post a Comment