Hello. This question: the page displays the news from the database news. It is necessary that the listing was made without reloading the page. I think the main point was conveyed ... I would like to see an example or what kind of documentation related to the topic. Thank you in advance!
3 answers
I implemented different types of workloads in my projects, look - maybe you will like something, I can explain later how and what works. Here are examples: zort.ru , darlabel.com , uniup.ru . Climb through the sites, there are many where the content is loaded by Ajax.
- uniup.ru/catalog Here it is very interesting to see ... - Ruslan Librovsky
- Look at the source code of the page, more precisely - on the event by clicking bookmarks, what is happening and what is being replaced. - metazet
- Well, that's exactly what I need !!! =) - Alexander Maslov
- Then add to the answer, mark as correct. - metazet
- <div id = "catalog-list-container"> <div id = "catalog-list-head"> <table> <tr> <td valign = "top" width = "420px"> University: </ td> < td valign = "top" width = "130px"> City: </ td> <td valign = "top"> <img src = "/ media / images / star.png" alt = "" title = "Rating" / > </ td> </ tr> </ table> <hr color = "# dfdfdf" size = "1px" style = "margin-bottom: 13px;" /> </ div> <! - The block will load here - -> </ div> as I understood in the catalog-list-container and the data is loaded, but did not understand where the jQuery code is for this scheme ... - Alexander Maslov
I can suggest to take a look at this article: dynamic loading of data on the page . An example of uploading comments to a page is given; if a little redoing is done, then a listing of news can be achieved.
- Yes, there is something to read! Thank! - Alexander Maslov
Well. You are in the tags all correctly written. For example, like this, with pages. If you have an "endless" listing in the style of vKontakte, then you need to track the offset of the object and the screen size, and do the upload and .append(data) as it approaches the end.
function getNews(page) { $.ajax({ url: 'news.php?page=' + page, success: function (data) { $('#news_div').html(data); } }); } On PHP, do not forget to do $page = intval($_GET['page']) before popping into the query. This is if the general idea.
- I will work on this, I will take note! Thank. - Alexander Maslov