开发者

JQuery between frames and ajax loads

I have a site with a main page, iframe, and multiple AJAX pages within the开发者_运维百科 iframe.

Example: Window(main page) > iFrame > Ajax Load > Ajax Load

I need to have JQuery available for all of these components, but the only way I have gotten this to work is to load a new instance of JQuery for the main page, the iframe, and every individual ajax load.

I have heard that you can use parent.$() to use JQuery from inside of an iframe, but I have also heard this can complicate selectors and I am not sure if this works at all for AJAX loads.

So, could somebody explain how I can load a single instance of JQuery and use it from inside an iFrame and any AJAX page that is loaded?


An iFrame works as a separate window, so you'll either need to use the parent selector or load jQuery within the iFrame itself. Assuming the iFrame does the ajax loads, only the parent page within the iFrame will need to include the js file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜