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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:44:46+00:00 2026-05-23T02:44:46+00:00

jQuery.get(ChkNewRspLive.php?lastmsgID= + n, function(newitems){ //some code to separate values of 2d array. $(‘#div1’).append(msgid); $(‘#div2’).append(rspid);

  • 0
jQuery.get("ChkNewRspLive.php?lastmsgID=" + n, function(newitems){
     //some code to separate values of 2d array.
     $('#div1').append(msgid);
     $('#div2').append(rspid);  
}); 

Let’s say the value of newitems is [["320","23"],["310","26"]]

I want to assign “320” and “310” to var msgid.

I want to assign “23” and “26” to var rspid.

How to do that?

I tried to display newitems and the output is “Array”. I tried to display newitems[0] and the output is blank.

If I redeclare var newitems = [[“320″,”23”],[“310″,”26”]]; it works. So I guess the variable newitems from jQuery.get is something wrong. Is it I cannot pass the array from other page to current page through jQuery directly?

Regarding the array on other page, if echo json_encode($Arraytest); the output is [["320","23"],["310","26"]] but if echo $Arraytest; the output is Array. How do I pass the array from other page to currently page by jQuery.get?

  • 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-23T02:44:47+00:00Added an answer on May 23, 2026 at 2:44 am

    I don’t totally understand the question but I’m going to assume you want the values in an array, as two values can’t be stored in one (scalar) variable simultaneously.

    jQuery.get("ChkNewRspLive.php?lastmsgID=" + n, function(newitems){
        //some code to separate values of 2d array.
        var msgid = [],
            rspid = [];
        for( i = 0 ; i < newitems.length ; i++){
            msgid[msgid.length] = newitems[i][0];
            rspid[rspid.length] = newitems[i][1];
        }
        //msgid now contains ["320","310"]
        //rspid now contains ["23","26"]
    }); 
    

    Bear in mind those are in the function scope. If you want to use them outside of that scope instantiate them outside. see: closure

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

Sidebar

Related Questions

I am fetching value using jQuery .get() like this $.get('clientarea.php', function(data) { var Val
I'm calling a jQuery GET on the test.php file code below. I'm trying to
How do I simply get GET and POST values with JQuery? What I want
jQuery.get(window.location.href, function(data) { alert(data); alert($(data).html()); }); The first popup is all the HTML good
i use the jquery get to fetch some plain html content form a file.
i m using jQuery.get() to delete row from a table from a page main.php
I have this jQuery get request: $.get($(this).attr(href), { searchExpression: schroders }, function (result) {
In some cases I'm sending jQuery.get() requests to an Action Method, and in other
I'm trying to use the jQuery.Get() function to return the contents of a webpage.
I'm using MVC3 - i have a javascript function that uses jQuery get() to

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.