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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:58:56+00:00 2026-05-27T03:58:56+00:00

I have an ajax call to a php file that encodes the array into

  • 0

I have an ajax call to a php file that encodes the array into a json array/object. What I am trying to do is to print the json response into a table format or an array of
div’s. I am stuck on how to handle the response on ajax success. Here is my ajax..

<script>
    $(document).ready(function(){
        $("#adapter").keyup(function()
        {
            var adapter = $(this).val();
            var dataString = 'searchword='+ adapter +'&format=json' ;
            if(adapter=='' || adapter < 2 )
            {
                $("#display3").hide('');        
            }
            else
            {
                $.ajax({
                    type: "POST",
                    url: "ajax/phpfile",
                    data: dataString,
                    cache: false,
                    success: function(data) 
                    {
                        var myObj = data;
                        ///NOT how to print the result and decode in html or php///
                    }
                });
            }return false; 
        });
    });
</script>

Here is the json response back from the server. I can alert the whole json response, so I know it is working on the ajax side…

{"Result":[{"ptos":{"PTOMasterID":"1","PTOMasterPart":"828B-U6805-L1CX","PTOSeriesUniqueID":"22","PTOPrice":"2715.78","PTOSeries":"82","PTOMounting":"8B","PTOTransmission":"U68","PTOSpeed":"05","PTOShifter":"L","PTOAssemblyID":"1","PTOShaftID":"C","PTOSpecialFeature":"X","PTODate":"2011-11-30 17:28:10"}},{"ptos":{"PTOMasterID":"2","PTOMasterPart":"828B-U6805-L3CX","PTOSeriesUniqueID":"22","PTOPrice":"2715.78","PTOSeries":"82","PTOMounting":"8B","PTOTransmission":"U68","PTOSpeed":"05","PTOShifter":"L","PTOAssemblyID":"3","PTOShaftID":"C","PTOSpecialFeature":"X","PTODate":"2011-11-30 17:28:10"}]}
  • 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-27T03:58:57+00:00Added an answer on May 27, 2026 at 3:58 am
    $(document).ready(function(){
        $("#adapter").keyup(function()
        {
            var adapter = $(this).val();
            var dataString = 'searchword='+ adapter +'&format=json' ;
            if(adapter=='' || adapter < 2 )
            {
                $("#display3").hide('');        
            }
            else
            {
                $.ajax({
                    type: "POST",
                    dataType: "json", //set this to json
                    url: "ajax/phpfile",
                    data: dataString,
                    cache: false,
                    success: function(data) 
                    {
                        var myObj = data;
                        ///NOT how to print the result and decode in html or php///
                        console.log(myObj); //to see the object
                    }
                });
            }return false; 
        });
    });
    

    Alternatively you could use JSON2.js like so

    JSON.parse(text, reviver)
    

    JSON 2 GITHUB

    • 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 is only accessed through ajax. The ajax call
i have a script that calls a php file and gets an JSON object
Within my index.php file I have an AJAX function that will call a function
I have this code that performs an ajax call and loads the results into
Initially, I used a .js file that contains AJAX functions to call a .php
I have a ajax.php file that contains the following sample code: switch($_REQUEST['request_name']) { case
First time dealing with json. I have a php file that processes the post
I have a php script that is waiting for ajax calls at www.mydomain.com/file.php The
i have an ajax call $.ajax({ url: '<%=Url.Action(SaveDetails,Survey) %>', dataType: 'JSON', cache: false, data:
I have an $.ajax call that includes both a success and error condition: $('input[name=StateName]').live('change',

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.