php - Pass data from a dynamically generated list from one page to another -
within jquery mobile app, have dynamically generated listview , want when user clicks list item, want value hidden field within listitem , pass value page can query based on variable value. (it's multipage layout)
since i'm in same dom first page, assume can access data using plain old variables , pass page. need know is, how value dynamically generated list. appreciated.
<ul data-role="listview" class="ui-listbox" data-theme="c" role="listbox" style="margin-top:20px"> <li data-role="list-divider" role="heading" tabindex="0" class="ui-li ui-li-divider ui-btn ui-bar-b ui-btn-up-undefined">today's journey</li> <?php foreach ($journeys $journey) : ?> <?php if ($journey['user_type'] == 0): ?> <li class="list-item-speaker" data-icon="false"> <a href="#journeydetails?id=<?php echo $journey['journey_id']; ?>" id="journeydetailsdriver" data-transition="flip" > <div class="list-item-content-speaker" style="float:left"> <img src="<?php echo $journey['facebook_image']; ?>" class="thumb-speaker-small" alt="<?php echo $journey['facebook_first_name']." ".$journey['facebook_last_name']; ?>" /> <h3 style="padding-left:10px;"><?php echo $journey['from_destination']." - ".$journey['to_destination']; ?></h3> <p style="padding-left:10px"><?php echo $journey['facebook_first_name']." ".$journey['facebook_last_name']; ?></p> <p style="padding-left:10px; padding-top:10px; font-size:0.9em; font-weight:bold"><?php echo $journey['depart_date']; ?></p> //value need hidden field <input type="hidden" name="journeyid" id="journeyid" value="<?php echo $journey['journey_id']; ?>"> </div> <h3 style="float:right; margin-top:45px; color:#189acb"><?php echo $journey['seats_available']. ' seats'; ?></h3> </a> </li> </ul>
you use url query tags, or save data in cookie or in html5 local/session storage.
to information list, here example
<ul> <li>coffee</li> <li>tea</li> <li>milk</li> </ul> var = [], list = document.getelementsbytagname("li"); array.prototype.foreach.call(list, function(entry) { a.push(entry.textcontent); }); console.log(a);
available on jsfiddle
Comments
Post a Comment