Billa
Billa

Reputation: 2039

jQuery: Fetch data on a part of page

I have seen some websites load static data on a page first, and in some part of it the dynamic data is loaded with jquery. For example please see this image:

enter image description here

At the moment, I fetch data from db using a simple mysql query, eg. select * from my_photos. I don't know how to do this with jQuery and PHP, so I'd be thankful if you can give me some example.

Upvotes: 0

Views: 159

Answers (3)

dSquared
dSquared

Reputation: 9825

If I understand your question correctly, you are looking to have static content (in this case images) loaded dynamically when users reach the part of the page they exist on.

Take a look at this plugin; I believe it is what you are referring to:

http://www.appelsiini.net/projects/lazyload

Good Luck!

Upvotes: 0

472084
472084

Reputation: 17885

You can use load() like this:

$('#div').load('sections.php #section1');

The #section1 part will filter out sections.php and only bring back the #section1 div, if you don't need it you can remove it.

Upvotes: 1

Kae Verens
Kae Verens

Reputation: 4079

look up the .get() and .post() functions in jQuery.

http://api.jquery.com/get/

http://api.jquery.com/post/

Upvotes: 1

Related Questions