The parent page gets the content of the child page_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:56:19
Original
1201 people have browsed it

Requirement description: Two JSP pages. The parent page needs the content of the child page, but the child page is hidden. Specifically, the child page is a series of templates, and the parent page needs to obtain these templates through ID. , unwilling to import through , because if there are too many templates, the entire parent page will be too large and slow to load. I wonder if the following two solutions can solve this problem.

1, through ajax Method

Implementation process: request to the subpage through ajax, and the subpage gets the parameter id and uses the interaction of java and js variables to return the required template information

Disadvantage: convert the js variable into Java variables are more troublesome. They need to be submitted using form forms, and the java script in jsp is run on the server side, which requires server-side resource overhead and increases the number of interactions

2, introduced through iframe

Implementation process: Use iframe to introduce subpages, and then obtain the required template through $(iframe.contents().find("#" id)[0]).val().

Disadvantages: Not sure if iframe can be delayed loaded. If you want to import the entire page like , this method is not ok.

We welcome readers and netizens to put forward their own opinions and methods for improvement.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template