Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6723297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:33:08+00:00 2026-05-26T09:33:08+00:00

I need to process this with php (note that the data being sent is

  • 0

I need to process this with php (note that the data being sent is JSON):

$.post("calculate.php", existingJsonData,
    function(data) {
    //alert("Data Loaded: " + data);
    console.log("test data", data.values);
});

The existingJsonData is formatted like this:

{
    "object1": {
        "object11": {"x": "10", "y": "20", "z": "30"}, 
        "object12": {"x": "40", "y": "50", "z": "60"}, 
        "object13": {"x": "70", "y": "80", "z": "90"}
  }, 
    "object2": {
      "object21": {"x": "100", "y": "200", "z": "300"}, 
      "object22": {"x": "400", "y": "500", "z": "600"}, 
      "object23": {"x": "700", "y": "800", "z": "900"}
    }
}

The php needs to add 1 to each of the x’s in “object2”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:33:09+00:00Added an answer on May 26, 2026 at 9:33 am

    This one adds 1 to each of the x’s in object 2 and alerts you the incremented values

    <?php 
    if ($_POST){ 
        ob_clean(); 
        $objects = $_POST['object2']; 
        foreach($objects as $a => $subObject) { 
            $objects[$a] = $subObject['x'] + 1; 
        }  
        die(json_encode((object) $objects)); 
    } 
    
    ?> 
    <script> 
    var existingJsonData=  $.parseJSON('{    "object1": {        "object11": {"x": "10", "y": "20", "z": "30"},         "object12": {"x": "40", "y": "50", "z": "60"},        "object13": {"x": "70", "y": "80", "z": "90"} },  "object2": { "object21": {"x": "100", "y": "200", "z": "300"},  "object22": {"x": "400", "y": "500", "z": "600"}, "object23": {"x": "700", "y": "800", "z": "900"}}}');
    $.post("<?php echo $_SERVER['PHP_SELF']; ?>", existingJsonData, 
        function(data) { 
        var data = $.parseJSON(data); 
        $.each(data, function(a,b){ 
           alert(a+' : '+b); 
        }); 
    }); 
    </script>
    

    demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to process the incoming predefined ASN format data(coming from verity of clients
I'm writing a CMS in ASP.NET/C#, and I need to process things like that,
I have a few arrays that I want to send to process with PHP.
I have just started a project that involves me sending data using POST in
I'm currently working on a PHP/MySQL script that does the following, in this order:
How can you make an own function in PHP such that I can bind
I need to run this php script http://db2express/imacs/radek/3.1/rationalTest.php?mode=create The processing time is about 10mins
I need some help with re-working the logic on this php code. What I'd
I'm trying to use PHP to process JSON and am having trouble parsing it
Assume that I need to insert the following document: { title: 'Péter' } (note

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.