Filling multiple divs by single ajax call using jquery


Sometimes we need to fill two divs simultaneously using ajax. Generally , we use two different ajax calls to achieve this rather knowing the fact that it can also be done using single ajax call. One simple example is better than hundered words. Lets setup an example.

Here is the DEMO


Suppose we have two different divs having Ids div_1 and div_2 respectively.

Click Me


AJAX file

The above divs to be filled simultaneously from ajax file having ids inner_1 and inner_2 respectively.

This is data from ajax file having id inner_1.
This is data from same ajax file having id inner_2.



Now, here is the trick of jquery , how divs on main page is filled simultaneously. (jquery latest pack included)



Here is the DEMO

All Done!

  • April 1, 2010
8 Best Free Stock Video Websites for Tiktok, Reels, and Shorts Top 5 PHP Frameworks: Fast and Secure