简体   繁体   中英

Grabbing information from one page and displaying it in another

I have a html page I'm making, which displays a bunch of category links - each of which link to an inventory page with a number of products. The client would like the page with the links to have the number of equipment available next to the title eg

Excavators (5)

The issue is, I dont have access to the back end of the inventory, its hosted with another company. At the top of each inventory it has a number of matches field, which is the information I need

在此处输入图片说明

Can anyone think of a way i can show that matches number on a different page dynamically (without php). The only thing I can think of at the moment is doing a really hatchet job with an iframe - but that wont be pretty or professional. Any genius thoughts would be appreciated!!

ps the page im linking to is internal in my site - the inventorys in an iframe

If the data you need is an identifiable container, and you can work out the url to retrieve it from, you could use the jQuery .load() method, eg

$( "#result" ).load( "ajax/test.html #container" )

Where #container has the data you want, and #result is where you want to load it to.

http://api.jquery.com/load/

You could store the web page as an html string in localStorage. It's not too complex.

localStorage.setItem('myPage','<div>Your html page in a string friendly format</div>');

to retrieve:

var retrievedObject = localStorage.getItem('myPage');
console.log('retrievedObject: ', retrievedObject);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM