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

The Archive Base Latest Questions

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

Is it possible with getJSON, to pass 2 different arrays? $.getJSON(‘<?php echo $_SERVER[‘SCRIPT_NAME’]; ?>’,

  • 0

Is it possible with getJSON, to pass 2 different arrays?

$.getJSON('<?php echo $_SERVER['SCRIPT_NAME']; ?>', {
    ajax: 'ajax_article_partlist' ,
    parent_article: $('#selected_article').val()
},
function(data) {
     $('#articles').html('');
     $('#article_table').show('slide');
        for (var i = 0; i < data.length; i++) {
        $('#articles').append("<p>"+data[i]+"</p>");
        }
});

this is my request ,on php side i echo and array. But i got now a second array i have to pass in same request. So is that possible, or do i have to make a new getJSON?

php code:

    case 'ajax_article_partlist' :
    header('Content-type: application/json');

    $form->addFormField(new FW_HTML_Form_Request('parent_article'));

    $form->resolveRequest();

    $parent_article = $form->getValue('parent_article');
    $part_list =$db_obj->getFormatedPartList($parent_article);
    $db_obj->checkArticleProgram($parent_article);

    echo json_encode($part_list);
    include($_SERVER['DOCUMENT_ROOT'].'/inc/includes/cms.footer.inc');
    exit;
    break;
  • 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-15T11:22:05+00:00Added an answer on June 15, 2026 at 11:22 am

    Here are array syntax details: http://www.php.net/manual/en/language.types.array.php

    echo json_encode(array("part_list" => $part_list, "second_array" => $second_array));
    

    And than in getJSON success function:

    function(data) {
         $('#articles').html('');
         $('#article_table').show('slide');
         for (var i = 0; i < data.parts_list.length; i++) {
                $('#articles').append("<p>"+data.parts_list[i]+"</p>");
         }
         for (var i = 0; i < data.second_array.length; i++) {
               //do somethign with second array
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Difference Between $.getJSON() and $.ajax() in jQuery super simple question.... between .getjson
Is it possible to hide name of *.php file in $(document).ready(function(){ $.getJSON(getdata.php, function(returned_data) {
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Is it possible to set async: false when calling $.getJSON() so that the call
Possible Duplicate: Is it possible to force jQuery to make AJAX calls for URLs
Possible Duplicate: Trying to use Google Places API with JQuery's getJSON function I am
Possible Duplicate: Ajax cross domain call I have Asp.Net Controller methods which return JSON
Possible Duplicate: jquery (ajax) redirect to another domain I have the jQuery Ajax request
Is it possible to load several data files (file1.xml, file2.xml, file3.xml,..) with jQuery.getJSON My

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.