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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:45:31+00:00 2026-05-21T03:45:31+00:00

I have two JQuery widgets, one is a sort of ‘main’ widget, the other

  • 0

I have two JQuery widgets, one is a sort of ‘main’ widget, the other could be considered a child. The child handles gathering specific data which is required by the main. The main is used with AJAX requests. So, the main has a set of options which are sent to the server. One of these options is also an option in the child.

To make this more clear, I have a main widget which has a few options. It then creates and appends a child widget. This child widget has an additional option that is required to be filled in the main widget before an AJAX request may be sent. In order to make this work, I am passing to the child: this.options.someArray

This works fine, however when changes are made to that array in the child widget, they never reach back to the main widget. This means the AJAX request sends an empty array in this place. How can I fix this?

[If this is not standard behavior – I can post a code sample]

Code sample for main Widget:

$.widget('be.deckEditor', {
  options: {
    deck: { name: "", id: 0, cards: [],  tags: [] }
  },

Code to create child Widget:

tagEditBox = $('<div>');
tagEditBox.tagEditor({tags:this.options.deck.tags});

Widget _Init code:

_init: function () {
  this.options.tags = ['ace','two'];
},
  • 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-21T03:45:32+00:00Added an answer on May 21, 2026 at 3:45 am

    If you want that “_init” code to re-set the “tags” contents, then don’t set it to refer to a brand new array:

    _init: function () {
      this.options.tags[0] = 'ace';
      this.options.tags[1] = 'two';
      this.options.tags.length = 2;
    },
    

    You could write a function to make a target array contain what another array contains; I don’t think there’s one built in but I can’t recall ever wanting to find such a thing:

    function arrayCopy(src, dest) {
      for (var i = 0; i < src.length; ++i) dest[i] = src[i];
      dest.length = src.length;
    }
    

    (The last line is only necessary if you want the destination to be a complete copy, length and all.)

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

Sidebar

Related Questions

I have two pages of jQuery, Page1 and Page2, and I'm able to get
How do I have two effects in jQuery run in sequence , not simultaneously?
I'd like to check ancestry using two jQuery objects. They don't have IDs, and
I want to split up the jQuery .js file into two, but I have
I have two applications written in Java that communicate with each other using XML
I have two classes, and want to include a static instance of one class
So i have these two jquery functions which pass my XHR service a key
Possible Duplicate: JQuery datepicker- 2 inputs/textboxes and restricting range Hi i have two pickers
I have two javascript functions, the first one is working, teh second is working
I have two arrays of animals (for example). $array = array( array( 'id' =>

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.