How to get the web pages from cache and restore data in the forms when i try to reach them from other pages of my site?

An4a

I have several pages with forms on my website. And I also have breadcrumbs navigation and main navigation. In some sense, the main navigation and breadcrumbs are very similar.

But what I want is when we click on breadcrumbs links we go to the pages from cache with data that we filled in forms before.

F.e.

I have page1, page2, page3. I go to page1, put some data in a form. Then go to page2 or page3. And I want to go back to page1 from my breadcrumbs navigation and see all the data that I've already put in the form.

history.back(); or history.go(); don't work in this case, because for this method we need the strait logic of riching the last page in the hierarchy. But in my case, it doesn't work, because I have both: main navigation and breadcrumbs that duplicating it (pls don't ask why), and the logic of riching the last page in the hierarchy can be chaotic.

I've tried to use windows.location.reload(); because by default, it should reload a page from the cache. But it doesn't work. Maybe I use it in the wrong way. Or there is another way to solve this problem.

html

<nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="page1.url">Page One</a></li>
                <li class="breadcrumb-item"><a href="page2.url">Page Two</a></li>
                <li class="breadcrumb-item active" >Page Thre</li>
                
            </ol>
</nav>

js

$(window).load(function(){    
        $('.breadcrumb-item a').each(function(index) {
            var link = $(this).prop('href');
            $(this).on("click", function(){
                link = windows.location.reload();
            })            
        });
    });
Tarik Merabet

I think you can use both https://api.jquery.com/serializeArray/ and https://developer.mozilla.org/fr/docs/Web/API/Window/localStorage to save your data as json to the local storage and retrieve them in any page. You have to do this when you change page:

jsonData = $("form").serializeArray()
localStorage.setItem('pageOneData', jsonData);

Feel free to ask me if it not clear

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I get dynamic content from a .txt file to display in multiple html pages when they are loaded dynamically

How do I allow post requests from my pages only?

How do I serve static pages from outside of my project?

How to scraping data from multiple pages in one web, I'm using Python and BeautifulSoup

Web-scraping data from pages with forms

How do I web scrap data from several pages of search results?

How to change my web-forms url from "Pages/Games.aspx?page=1" to "games/1"?

How to get all pages data from site and save?

How do I offset an anchor to adjust for a fixed header when linking from other pages?

Web development: How to 'store' pages in the browsers and prevent them from reloading every time when navigating between them

get all pages from the page cache

How can I call hundreds of PHP pages from my browser?

How to avoid web browser warning when my site use HTTPS protocol, and it's pages include images from sites without HTTPS?

How do I create web pages in my home directory and have the web server serve them in my web browser?

how to prevent other users on the network who know my IP from accessing pages other than I want them to?

How do I extract data from multiple related web pages in Android using Jsoup?

collect text from web pages of a given site

How to get url from webview whenever user move to other pages

Fetch posts from different Facebook pages and automatically post on my web site?

Traceback when trying to read data from web pages

How do I web scrape data from several pages of search results?

Web Scraping: How to get info from dynamic pages?

How can I make my site’s visitors access my web pages without adding the page extension

Got undefined when I try to reach data from node API

Why are my cookies and signedCookies empty in req when I try to get them from port 3000?

How do I get scrape data from web pages using beautifulsoup in python

How i can get data from the diffrent pages and render that data into another page using shared preferences in flutter

i try add data from my component to other component

How do i get a css page included in my header page on other php pages on my site?

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

  9. 9

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  10. 10

    How to remove the extra space from right in a webview?

  11. 11

    java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

  12. 12

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  13. 13

    flutter: dropdown item programmatically unselect problem

  14. 14

    How to use merge windows unallocated space into Ubuntu using GParted?

  15. 15

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  16. 16

    Nuget add packages gives access denied errors

  17. 17

    Svchost high CPU from Microsoft.BingWeather app errors

  18. 18

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  19. 19

    12.04.3--- Dconf Editor won't show com>canonical>unity option

  20. 20

    Any way to remove trailing whitespace *FOR EDITED* lines in Eclipse [for Java]?

  21. 21

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

HotTag

Archive