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 6844377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:22:09+00:00 2026-05-27T00:22:09+00:00

i have this code for sending data var test={imagename:apple.jpg,x:13,y:33}; $.ajax({ type: POST, url: some.php,

  • 0

i have this code for sending data

  var test={imagename:"apple.jpg",x:"13",y:"33"};

  $.ajax({
 type: "POST",
     url: "some.php",
     data: test,
     success: function(response){
    console.log(response);
    }
   });

but now i want to send multiple data to php.My php side code is like this

print $_POST['imagename'];

i think of an approach like this
var test={imagename:"apple.jpg|hen.jpg",x:"13|44",y:"33|22"};
and on php getting $_POST['imagename'] then split it according to | but i am not liking semantic approach of it.
1-Does any one know better solution?
2-Please provide both javascript,jquery and php code for answer.
3-One final question is this notation called json var test={imagename:"apple.jpg",x:"13",y:"33"};
Thanks

  • 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-27T00:22:10+00:00Added an answer on May 27, 2026 at 12:22 am

    An array is the most meaningful solution here – something like this in JavaScript:

    var data = [
        {imagename:"apple1.jpg", x:"13", y:"33"},
        {imagename:"apple2.jpg", x:"51", y:"84"},
        {imagename:"apple3.jpg", x:"79", y:"57"}
    ];
    

    Send as:

    $.ajax({
         type: "POST",
         url: "some.php",
         data: {data: data},
         success: function(response){
             console.log(response);
         }
     });
    

    and in PHP you can get them like:

    <?
        print_r($_POST['data']); // dumps an array
    
        $filename1 = $_POST['data'][0]['filename']; // filename of item #1
    ?>
    

    Lastly, var test={imagename:"apple.jpg",x:"13",y:"33"}; is nothing more than some JavaScript code. It is not JSON. Although JSON looks like JavaScript (JS even stands for JavaScript in JSON), it is nothing more than the characters you’re sending. JSON is a format for transferring data. As soon as you “unpack” it (either in JavaScript or PHP) then it’s not called JSON anymore.

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

Sidebar

Related Questions

I have this ajax call at the moment: $.ajax({ url: misc/sendPM.php, type: POST, data:
For some reason ajax is not sending data. On the PHP I have this
I have this JS code: var recipesPost = function(name, ingredients, steps) { $.post('/api/recipes', {
I have this code: chars = #some list try: indx = chars.index(chars) except ValueError:
I have this code that performs an ajax call and loads the results into
This is an erlang problem, it seems. I have this code to test the
I have this piece of AJAX that validates the login credentials by sending the
I have this code just to send data from already loaded jqGrid: jQuery(#bedata).click(function(){ //Function
so far i have used this code.It is working when i am sending the
We have a Java client that sending us some encrypted data 1. A random

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.