Jump to content

7blake

Members
  • Posts

    32
  • Joined

  • Last visited

7blake's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. Yes thankyou both @Brand - IThanks for clarifying and supplying the correct way. I appreciate it. I was using the foreach on the Value, not the Key from the outer object. Bah. Thanks! @nik_jain - Thankyou for that bit of information. That's a pretty crucial fork in the road. Cheers
  2. basic ajax/php relationship below. You could set it up, and then have it on a timed loop function, if you need it to run during a specific set of time. It just needs some tweaking depending on the sort of data you are sending, but the overall base structure is there. $.ajax({ method: "POST", // Or GET url: 'path', // URL to your server page data: {parameter1: value1}, // parameters -- can be multiple. pareameter1 is what you target with $_POST['parameter1'] in PHP - value1 is your data. success: function(data) { // PHP's echoed data // Do something with the echoed data } //php if(isset($_POST['param1])){ $retrievedData = $_POST['parameter1']; echo $retrievedData; } });
  3. I'm grabbing an object with objects that is converted to JSON, then decoded in PHP newObject = {"firstObject":{"Color" : "red"}, "secondObject":{"Color":"blue"}}; anyhow, I can get this to PHP fine, and access it with the foreach loops. But I can't access "firstObject" or "secondObject". $someArray = json_decode($_POST['containerPositions'], true); foreach($someArray as $value){ foreach ($value as $secondKey){ echo getClass($value) . " " . $secondKey;} } Could someone tell me what is the correct method for accessing them?
  4. I'm grabbing an object with objects that is converted to JSON, then decoded in PHP newObject = {"firstObject":{"Color" : "red"}, "secondObject":{"Color":"blue"}}; anyhow, I can get this to PHP fine, and access it with the foreach loops. But I can't access "firstObject" or "secondObject". $someArray = json_decode($_POST['containerPositions'], true); foreach($someArray as $value){ foreach ($value as $secondKey){ echo getClass($value) . " " . $secondKey;} } Could someone tell me what is the correct method for accessing them?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.