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

  • SEARCH
  • Home
  • 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 6528271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:31:09+00:00 2026-05-25T09:31:09+00:00

Following on this post , I have another problem – how can I combine

  • 0

Following on this post, I have another problem – how can I combine two json data objects?

first json object,

{"file":{"name":"1024x768.jpg","type":"image\/jpeg","tmp_name":"C:\\wamp\\tmp\\php2C2E.tmp","error":0,"size":469159}}

second json object,

{"title":"title","content":"bla bla blah"}



$.post("process.php", first + second ,function(xml){

});

So I can get this array in process.php using print_r($_POST):

Array
(

[file] => Array
        (
            [name] => 1024x768.jpg
            [type] => image/jpeg
            [tmp_name] => C:\wamp\tmp\phpA1.tmp
            [error] => 0
            [size] => 469159
        )

    [title] => title
    [content] => bla bla blah
)
  • 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-25T09:31:09+00:00Added an answer on May 25, 2026 at 9:31 am

    Looking at your first data object file is not an array as you are expecting it in the server side php code. It is a JSON object. Anyways you can try this to combine the data objects and post it.

    var data1 = {"file":{"name":"1024x768.jpg","type":"image\/jpeg","tmp_name":"C:\\wamp\\tmp\\php2C2E.tmp","error":0,"size":469159}};
    var data2 = {"title":"title","content":"bla bla blah"}
    
    var data = data1;
    data.title = data2.title;
    data.content = data2.content;
    
    $.post("process.php", data ,function(xml){
    
    });
    

    Alternatively you can use jQuery.extend method which merge the contents of two or more objects together into the first object.

    var data1 = {"file":{"name":"1024x768.jpg","type":"image\/jpeg","tmp_name":"C:\\wamp\\tmp\\php2C2E.tmp","error":0,"size":469159}};
    var data2 = {"title":"title","content":"bla bla blah"}
    
    $.post("process.php", $.extend({}, data1, data2) ,function(xml){
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following from this thread: Another IE jQuery AJAX/post problem (please read the thread to
What could be the understanding of the following? I have gone through this post
Using the following steps: (I have checked this similar post , which does not
I have been following the guidance given on this other post: Assigning an IronPython
I have the following code used to post data to a remote server: NSString
Following this post and the other posts that it links to, I have successfully
this is my first post on this great source of programming information. I have
Another question for all WP7 lovers! We have the following problem: we have creates
I'm trying to implement routing such as the following: posts/535434/This-is-a-post-title posts/tagged/tags+here // Matches {controller}/{action}/{id}
Following this example, I can list all elements into a pdf file import pyPdf

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.