php - How do I load Individual Div without load entire page and show loading status? -


How can I load different divs without affecting the current page, and PHP and MySQL for that div Ajax and SQL

I do this:

Firstly with looping There is a hidden divisor and one load button in it:

   

Then you have a JS code (I use jQuery)

  & lt; Script type = "text / javascript" & gt; $ (Document) .ready (onDocumentReady); // This page runs on load function on document readie () {$ ('# loadbayton'). Click (onloadload); // assign action to button} function onloadclick () {$ ('# loadingGif'). Show (); // Show loading GIF will not show until its parents hide $ ('# real content') Hide (); // Hiding the real content of the response; $ ('# DisplayDiv') Show ().; // div $ .get Display ("test.php", onRequestComplete); // Request AJAX alone for PHP file file / so long loading material will show GIF loading; } Security complete on function (data) {$ ('# loadingGif'). Hide (); $ ('# Actual container'). Html (data); $ ('# ActualContent') Show (). } & Lt; / Script & gt;  

Then you have the container "displayDiv"; You have an image "loading GIF" and another container "real container"; When you click on the load button, a large container appears with loading GIF, the user loads something when the content is loaded, then you simply hide the loading GIF, and the information is "actual container" Display in GIF. In test.php you should only show in echo. I recommend using JSON, but you will read more about it.

Hope this will be helpful.


Comments