elbatron
elbatron

Reputation: 705

jQuery load div content right syntax

What is the right syntax for the following?

postid is the slug I need to add to the url; I need the content only of the article div from the remote page; I'm also passing the postid to the remote page

.load("http://something/crew/?=" + postid .article ,{id:postid});

Thanks.

Based on the answer below the right syntax is:

.load("http://something/crew/?=" + postid + " .article" ,{id:postid});

Upvotes: 1

Views: 184

Answers (1)

jantimon
jantimon

Reputation: 38160

.load("http://something/crew/?id=" + postid  + " .article");

Note that there is a space before .article.

From http://api.jquery.com/load/#loading-page-fragments

If one or more space characters are included in the string, the portion of the string following the first space is assumed to be a jQuery selector that determines the content to be loaded.

Upvotes: 2

Related Questions