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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:21:29+00:00 2026-06-15T17:21:29+00:00

In the below code, for each staff member I am trying to grab a

  • 0

In the below code, for each staff member I am trying to grab a list of the group_ids of groups they supervise and then I want to stringify the array containing those ids and send it off to update the database.

However, when I try to stringify the mapped array, I get an error about converting a circular structure. I don’t quite see what is circular in the below code.

Any help is much appreciated.

$(".staff_member").each(function() {
        var staff_id = $(this).attr("staff_id");

        var newarr = $(this).find(".staff_groups .staff_group").map(function() {
            return $(this).attr("group_id");
        });
        alert(JSON.stringify(newarr));
        $.post(
            "staff_update.php",
            { staff_id: staff_id, groups: newarr },
            function(data) {
                var response = jQuery.parseJSON(data);
                if(response.code == "success") {
                    alert("Done!");
                } else if(response.code == "failure") {
                    alert("Failure!");
                }
            }
        );
    });
  • 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-15T17:21:30+00:00Added an answer on June 15, 2026 at 5:21 pm

    Convert that to an array first .. .map() returns a jQuery Object

    var newarr = $(this).find(".staff_groups .staff_group").map(function() {
                return $(this).attr("group_id");
            }).get() ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the below code I'm trying to loop through each child node and append
What i want is that each animation, from the code below, to start with
I use below code to update listview. setListAdapter(MyAdapter); MyAdapter.notifyDataSetChanged(); getListView().setEmptyView(empty); But each time update,
My code below is supposed to display each question ($_POST[questionText]). For each question, it
The code below shows me (I think) that the for each loop is about
The code below works nicely. Each title in the MySQL table submission is printed
I really can't understand how the below piece of code is working... options.each {
Why does the code below set my @groups array to: @groups=[[[24, 25, 26], [27,
I'm trying to get the column names using the code below but it returns
In code below, I expect variable counter to incement by 1 on each repetition,

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.