jquery - Ajax load - several containers -


i reading jquery load method. not know if there way load 2 different parts of response in 2 different containers, using single ajax call, like:

$( "#b" ).load( "article.html #targetinb" ); $( "#a" ).load( "article.html #targetina" ); 

but using single ajax call.

thanks in advance.

i don't think it's built-in. however, can load entire contents hidden element temporarily, move there target elements. reduce number of ajax calls 1:

$('#temp').load("article.html", function() {   $('#a').append($('#temp #targetina'));   $('#b').append($('#temp #targetinb')); }); 

here using optional callback ability of .load post-processing after result returned ajax call. #temp div gets entire contents ajax. each individual piece appended respective div.

demonstration: http://jsfiddle.net/j4dkc/


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -