javascript - There is this kind of query at the top of every page. How to encapsulate it with ajax and call it repeatedly?
过去多啦不再A梦
过去多啦不再A梦 2017-05-19 10:24:59
0
3
435

过去多啦不再A梦
过去多啦不再A梦

reply all(3)
淡淡烟草味

1. If you are using popular frameworks, such as ng, react and vue, you can encapsulate it into a component;
2. If it is a classic HTML page, you can encapsulate the query box and related ajax processing into a sub-page and introduce it with an iframe ; Or encapsulated into a js file, and the html part is generated by js.

淡淡烟草味

Create a search.js

Write everything in DOM into js, ​​wouldn’t it be great

为情所困

Cache the first query result to sessionStorage, and then obtain it directly from sessionStorage

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template