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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:03:34+00:00 2026-06-15T09:03:34+00:00

So, I have a JSON array that I want to POST to a file

  • 0

So, I have a JSON array that I want to POST to a file and then receive a response. But somehow it doesn’t seem to work, so I was hoping you guys could help me a bit out.

data = JSON.stringify({
        "jsonrpc": "2.0",
        "method": "login",
        "id": 1,
        "params": {
          "params": {
            "username": "1234",
            "password":  "4321"
          }
        }
      });

$.ajax({
        url:"functions/proxy.php",
        type:"POST",
        data : data,
        success: function(data){/* do something*/ },
        error: function(data) {/* do something*/)}
      });

When I submit the form, the error function runs, and I get this when var_dumping $_POST:

array(0) {
}

Weird thing is, when data looks like this:

data: "username=1234&password&4321"

I get this:

Array
(
    [username] => 1291
    [password] => 1877
)

Could anyone help me with how I can be able to send the data in JSON format?

  • 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-06-15T09:03:35+00:00Added an answer on June 15, 2026 at 9:03 am
    $.ajax({
            url:"functions/proxy.php",
            type:"POST",
            data : data,
            success: function(data){/* do something*/ },
            error: function(data) {/* do something*/)}
          });
    

    should be

    $.ajax({
            url:"functions/proxy.php",
            type:"POST",
            data : {mydata:data},
            success: function(data){/* do something*/ },
            error: function(data) {/* do something*/)}
          });
    

    try

    print_r($_POST);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP file that returns a JSON array. I need to extract
I have a PHP file that serves up a JSON array populated from a
I have a php file somejson.php that echos a json encoded array {jsonone:first json,jsontwo:second
I have a PHP function that builds a JSON array via $jsonArray= array(); for
I have a json object that looks something like this: Array ( [algorithm] =>
I have an iPhone app with an array of objects that I want to
I have an array dump that I want to compress into a string that
I have a 2d array of strings (12x5) that I want to pass from
I am getting data from severs in json format but i want that user
I have some PHP script that logs in and returns a JSON array with

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.