Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load multiple items with .load() with only one request?

Tags:

jquery

When I use a load() in load() function to load different elements from another page in one I have two request.

How can I make into one? Like this idea:

$mainContent.load(newHash + " .first"," .second", function() { });

Cause the problem I ran in is that a page that I loaded with a contact form sends twice cause I "thinks" it got loaded twice.

Heres the full code fragment:

if (newHash) {

            $claim.find("#claim").find("p").fadeTo(200,0);

            $mainContent.find(".maincontent").fadeTo(200,0, function() {

                $mainContent.fadeTo(0,0).load(newHash + " .maincontent", function() {

                        $claim.find("#claim").find("p").fadeTo(0,0, function() {

                            $claim.load(newHash + " #claim", function() {

                                $("#claim").fadeTo(0,0).fadeTo(200,1);

                                $mainContent.fadeTo(200,1);
                            });

                        });                
                });
            });   
        };

So how am I able to load multiple, different items with only one .load() request?

Is that possible?

Thank you.

like image 246
Melros Avatar asked Nov 04 '22 13:11

Melros


1 Answers

This works:

$mainContent.load(newHash + " .first, .second", function() { });

The answer is right here:

Jquery Multiple load in a DIV

like image 89
Melros Avatar answered Nov 15 '22 01:11

Melros