How to load with jQuery only once, then use selectors without additional HTTP requests -
could me code, please?
jquery(document).ready(function(){ jquery('#div1').load('/text.php #p1'); jquery('#div2').load('/text.php #p2'); jquery('#div3').load('/text.php #p3'); jquery('#div4').load('/text.php #p4') });
when using code, browser makes http request time when needs open same file text.php
. difference in selectors. can tell me if it's possible load file text.php
once, , use selectors fill content of different div
s?
you can use request try like
jquery(function ($) { $.get('/text.php', function (html) { var $html = $('<div />', { html: html }); $('#div1').empty().append($html.find('#p1')) $('#div2').empty().append($html.find('#p2')) $('#div3').empty().append($html.find('#p3')) $('#div4').empty().append($html.find('#p4')) }, 'html') });
Comments
Post a Comment