javascript - Advance internal array pointer to next record to fill jquery function to use insertAfter -
I am a jquery newbie and I am trying to create a jquery function with the information supplied with php. I'm sorting the div to display in the order of value with the insert object. (What's an easy / easy approach?) My point is that I can not advance the pointer to advance on the next record to fill my foreclosure loop.
My PHP: My jquery: > $ (Document) .ready (function () {var peter = $ ("# peterDIV"); var lois = $ ("# loisDIV"); var brian = $ ("# brianDIV"); & lt ;? php foreach ($ my_array as $ x = & gt; $ x_value) {echo strotler ($ x) ".interval (". strtolower ($ x) ");";}}? "gt;}); I have the next () and array_shift () but I think my syntax is off. Edit Desired Results I want to jquery displa y in the order based on the values obtained in a SQL database from a query div. Your solution:
$ my_array = array ("peter" => "100", "LOIS =>" 75
peter.insertAfter (peter); lois.insertAfter (Lois); Brian.insertAfter (brian);
lois.insertAfter (peter); Brian.insertAfter (lois);
$ My_array = array ("PETER" =>, "100", "LOIS" => "75", "BRIAN" => "25"); arsort ($ my_array); $ Previous_key = ''; Check the first repetition of foreign currency ($ my_array $ key = & gt; $ value) {// loop - if this key is set and leave the rest of the loop ($ previous_key === '') {$ previous_key = $ key; to continue; } // Similar to your solution, but sets the second key as the echo string ($ key) ".insertAfter (". Strtolower ($ previous_key). "); \ N"; // current key $ previous_key = update the last key with key; }
Comments
Post a Comment