Peter Kroman
asked on
Resetting part of a page on submitting a form
I have this page:
https://kroweb.dk/gfdev/arkivalier/canvas3/
I need to reset one div when submitting the search form.
If you hover over the map to the left and click a selection, you get a couple of text blocks to the right. Those blocks are nested in this div:
<div id="herredssogne_list"> </div>
It is this div I need to reset when submitting the search form.
Could that be done within a script?
https://kroweb.dk/gfdev/arkivalier/canvas3/
I need to reset one div when submitting the search form.
If you hover over the map to the left and click a selection, you get a couple of text blocks to the right. Those blocks are nested in this div:
<div id="herredssogne_list"> </div>
It is this div I need to reset when submitting the search form.
Could that be done within a script?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Fine, it also explained a lot to see your site.
I forget to explain, why the load solution is not ideal. Well, you load window.location.href, the whole current page, only to extract a part of it. Ideally, you had a script or functionality that returns just the div content you want, that would give minimum server load. You actually do have getParishes.php, so if your div would initially show one regions data, you could reset to that via that script.
On the other side, the ideal composition of a web page from single scripts each providing snippets you can put together is typically rather replaced by a template engine. but that's getting off topic shoptalk.
A bigger problem with reloading window.location.href is, that it might need the right post or get variables set to get the page as is, and then you don't want to reset post variables, when they generate and save some content, as you then create this double.
But all that luckily is no problem here anyway, when resetting only means emptying.
Bye, Olaf.
I forget to explain, why the load solution is not ideal. Well, you load window.location.href, the whole current page, only to extract a part of it. Ideally, you had a script or functionality that returns just the div content you want, that would give minimum server load. You actually do have getParishes.php, so if your div would initially show one regions data, you could reset to that via that script.
On the other side, the ideal composition of a web page from single scripts each providing snippets you can put together is typically rather replaced by a template engine. but that's getting off topic shoptalk.
A bigger problem with reloading window.location.href is, that it might need the right post or get variables set to get the page as is, and then you don't want to reset post variables, when they generate and save some content, as you then create this double.
But all that luckily is no problem here anyway, when resetting only means emptying.
Bye, Olaf.
ASKER
Nice and working solution. And fine explanation too :)