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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:03:19+00:00 2026-05-22T18:03:19+00:00

I am using jquery’s ajax method to post some data to the server and

  • 0

I am using jquery’s ajax method to post some data to the server and get back the response. Though the server side php code is returning a json encoded string/array, the response is coming back as null.

Could someone point out the mistake that I am making. Below if my jquery ajax method using which I am hitting the postData.php page.

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

The content in postData.php is pretty straight forward as I am still developing it.

    $data = array();
//inside postData.php
    $data['test']=1;
    return json_encode($data);

It should return a json string, but it is returning null. I also tried echoing a string just after $data array declaration, it does echo it in the firebug, but the response is when I do a console.log on the success callback, it comes back as null.

  • 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-22T18:03:20+00:00Added an answer on May 22, 2026 at 6:03 pm

    Is that all that is in postData.php? You need to write it out to the buffer (echo json_encode($data);) at some point.

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

Sidebar

Related Questions

When using jQuery 's ajax method to submit form data, what is the best
Using jquery, i fetch a data from php to div $.post(url.php?info=+$('#info').val() // rest of
Using jQuery Ajax to fetch data from local server: it works well with IE8
Using jQuery's delegate() method, can I get the index number of the current element?
I'm using jQuery and SimpleModal in an ASP.Net project to make some nice dialogs
Using jQuery, while in the span element, without knowing post-383 id and class, how
using jQuery, I'm trying to get values of fileTypes by using an index. I'm
Using jquery, I'd like to get all elements in a specified columns of an
Without using jQuery (can't get into why NOT right now) how do I disable
By using jquery ajax function, I can do something like: $.ajax({ url: url, type:

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.