Maybe you just need a template engine.(like smarty) ------------------ Original ------------------ From: "dealTek";<dealtek@xxxxxxxxx>; Date: Sun, May 3, 2015 04:48 AM To: "PHP General"<php-general@xxxxxxxxxxxxx>; Subject: [PHP] Beginner javascript newbie - wants to learn some basics - display results from php query [OFF TOPIC] Hi all, I know this is not a javascript forum - but could use some basic javascript beginner help or URL's to get started... Beginner javascript newbie - wants to learn some basics - display results from php query example... Q: If I request just a single record result - like query ends with - print_r (json_encode($output)); how can I display various fields at different areas of the page using javascript query result? With php I can display a field output like: html ... html ... <?php echo $record->getField('FirstName'); ?> html .... html ... Q: So how do I convert the PHP query result - print_r (json_encode($output)); - to place php field results randomly where I want mixed in with html? First Name is: <?php echo $record->getField('FirstName'); ?> <br /> - ?CAN I JUST PUT FirstName here using javascript not php like ... <???JAVASCRIPT field ???> FirstName <???/JAVASCRIPT ???> Last Name is: <?php echo $record->getField('FirstName'); ?><br /> Phone is: <?php echo $record->getField('Phone'); ?><br /> Street is: <?php echo $record->getField('Street'); ?><br /> etc. ================= WHAT I HAVE in javascript - works but it forces me to put the html inside the script so whole thing inside ........... <script> $(document).ready(function(){ $("button").click(function(){ $.get("getstuff.php", function(data, status){ // alert("Data: " + data + "\nStatus: " + status); console.log ('data', data); output = ""; $.each(data, function(key, value) { console. log ('item', key, value); output += " Name is: " + value.FirstName + " " + value.LastName + "<br>"; }); $('#list').html( output ); $('#list').listview( "refresh" ); }); }); }); </script> -- Thanks, Dave - DealTek dealtek@xxxxxxxxx [db-15]