Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your result is evaluated as an array in javascript from your output. Take a look at the reference : <a href="http://www.json.org/" rel="nofollow noreferrer">http://www.json.org/</a> </p> <p>For a demo purpose I've just dummy tested what's the output of your method for more than 2 boxes. So your result from your php script may look like this: </p> <pre><code> [{ "dept": "dept", "company": "conmpany", "address": "address", "service": "service", "box": "box1", "destroydate": "destroydate", "authorised": "authorised", "submit": "submit" }, { "dept": "dept", "company": "conmpany", "address": "address", "service": "service", "box": "box2", "destroydate": "destroydate", "authorised": "authorised", "submit": "submit" }, { "dept": "dept", "company": "conmpany", "address": "address", "service": "service", "box": "box3", "destroydate": "destroydate", "authorised": "authorised", "submit": "submit" }] </code></pre> <p>On javascript side this is processed as an array of objects. Since is a standard array a <code>for</code> loop would be sufficient to retrieve the values, therefore your method may look like this: </p> <pre><code>$.post('/sample/admin/requests/boxes/boxesadd.php', data, function(msg) { var messageOutput = ''; for (var i = 0; i&lt;msg.length; i++){ messageOutput += msg[i].box+' '; } $("#BA_addbox").html("You have entered box(es): " + "&lt;b&gt;" + messageOutput + "&lt;/b&gt;&lt;br /&gt; You may now close this window."); //console.log(msg[0].box); $("#BA_boxform").get(0).reset(); }, 'json'); </code></pre> <p>Ofcourse you can use <code>$.each</code> function but is not always a solution to use the bulldozer when just a shovel is required. </p> <p>As for the json output in firebug is already there starting with the version 1.4a11 : <a href="http://www.softwareishard.com/blog/firebug/json-explorer-for-firebug/" rel="nofollow noreferrer">http://www.softwareishard.com/blog/firebug/json-explorer-for-firebug/</a></p> <p><img src="https://i.stack.imgur.com/UyyUO.jpg" alt="json tab on firebug"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload