ajax - Hot to get all the images to display without reloading the page in PHP? -


After the user's click, the signal button button passes halfway through the path of the data and then the code below is given the second half Links in I want to know how can I display this page without reloading? I know that it can be done with AJX but I do not know how to do this. So can anyone help please?

  & lt ;? Php $ albumnamepath = $ _POST ['field']; Ebb $ albumnamepath; $ Display = "SELECT * from paths where user_id = '$ session_user_id' and album_name = '$ albamma-path'"; $ Result = mysql_query ($ display); Echo "& lt; Table & gt;"; $ I = 0; While ($ line = mysql_fetch_array ($ result)) {if ($ i% 4 == 0) {// 3 == 0. echo ' "; // echo '& lt; a href =' '. $ Albumnamepath $ Row ['location']. '' class = "swipebox" title = "'. $ line [' caption '].' '& gt; & lt; img src = "'. $ Albumnamepath $ line ['Thumbnail']. ' '& Gt;'; If ($ i% 4 == 3) {// 3 == 2. Echo '  

Thanks. I do not think Ajax will help you a lot, because you will use Ajax, basically, Whole page Ajax usually if you want to change a part of the page, and the data is either to come from a real-time server (i.e. after page load), or is completely expensive to calculate or distribute (like too long, or Infinite list, and if most users only use a small amount) Otherwise, all the data at once is more efficient to send, and then manipulate it in the browser.

I will suggest the following approach: split table rows into a table row; Change the block of code such as 5 rows (arbitrarily selected) where you copy '':

  if ($ i% 4 == 0) {// 3 == 0 $ block = ceil ($ i / (4 * 5)); Echo & lt; Tr class = "block_ $ block" & gt; '; }   

This means that each block in 5 rows (in 4) will be a separate class - "block_1", "block_2" and many more.

Then, you can hide and display blocks using Javascript. To hide a block, use the following javascript code:

  var trToHide = document.getElementsByClassName ("block_1"); For (var i = 0; i & lt; trToHide.length; i ++) {trToHide [i] .style.display = "none"; }   

Show the block:

  var trToHide = document.getElementsByClassName ("block_3"); (Var i = 0; i & lt; trToHide.length; i ++) for {trToHide [i] .style.display = "block"; }   

Obviously, you want to use the variable to keep track; You can have a "Next" and "Back" button, which hides the existing block, adds one / decreases one, then (new) displays the current block, except for the first hidden in the beginning, you also want all the blocks . Leave the reader as an exercise.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -