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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:31:56+00:00 2026-05-31T19:31:56+00:00

I am currently editing a WordPress plugin, which allows you to filter posts by

  • 0

I am currently editing a WordPress plugin, which allows you to filter posts by category, once a category is selected, the posts for that caregory are displayed as a checklist on the widget, the user can select the posts they wish to display in their sidebar/widget area of the theme.

I have taken the widget to the point that the user can select their post, the widget allows a single post to be selected, however if more than one is selected and the save button is pressed, the form returns only the last slected post.

After some searching, I have found the problem to be on the form return.
It is either to do with the update, or the way AJAX handles multiple instances of a variable.

the information posted to the server is as follows:

action  save-widget
add_new 
id_base single_post_super_widget
multi_number    
savewidgets 9bc3d79f1c
sidebar lcp-sb
widget-height   200
widget-id   single_post_super_widget-2
widget-single_post_super_widget[2][object_to_use]   5005
widget-single_post_super_widget[2][object_to_use]   4892
widget-single_post_super_widget[2][object_to_use]   4607
widget-single_post_super_widget[2][object_type] 72
widget-single_post_super_widget[2][paged]   1
widget-single_post_super_widget[2][tab] all
widget-single_post_super_widget[2][title_override]  
widget-width    400
widget_number   2

Where object_to_use is the post(s) being selected.

the information being sent is defined here:

var theArgs = {
    action: jQuery('input.widget_class:hidden', widgetDiv).first().val() + '-get-metabox',
    widget: widgetDivId,
    number: widgetNumber,
    blog_id: jQuery(widgetInputBase + 'blog_id').val(),
    object_type: jQuery(widgetInputBase + 'object_type').val(),
    tab: currentTab,
    paged: currentPage,
    object_to_use: jQuery('input[type=checkbox][name$="[object_to_use]['+currentTab+']"]:checked', widgetDiv).first().val(),
    title_override: jQuery(widgetInputBase + 'title_override').val(),
    excerpt_override: jQuery(widgetInputBase + 'excerpt_override').val(),
    searched: ('search' == currentTab) ? jQuery('input.quick-search', widgetDiv).first().val() : ''
};

and the jQuery.post action:

jQuery.post(
    ajaxurl,
    theArgs,
    function( r ) {
        jQuery('.ajax-feedback').css('visibility', 'hidden');
        if ( r && r.length > 2 ) {
            jQuery('div.widget-content', widgetDiv).html(r);
        }
    }
);

In relation to the question, widget-single_post_super_widget[2][object_to_use] is being posted multiple times, how does AJAX handle this? Does each post/variable have to be unique?

  • 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-31T19:31:57+00:00Added an answer on May 31, 2026 at 7:31 pm

    widget-single_post_super_widget[2][object_to_use] is being posted multiple times, how does AJAX handle this?

    There is nothing Ajax specific about this. You just get multiple copies of the key in the data submitted to the server.

    Does each post/variable have to be unique?

    No.

    In most server side environments, you can get all the data just by using the right function. For example with Perl’s CGI.pm module, you just get the parameter in list context:

    my @thing = $cgi->param('widget-single_post_super_widget[2][object_to_use]');
    

    … and it will ‘just work’.

    PHP is special. If the name ends in [] then it will just create an array in $_POST and friends. If it doesn’t, then it will discard all but the last item. (Unless I’m misremembering and it keeps the first instead).

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

Sidebar

Related Questions

I am currently using the advanced editing tableview as outlined in Monotouch.Dialog that allows
I have a jTable which currently displays and allows editing of a database table,
I am currently designing a portfolio website with wordpress. The idea is that it's
I'm currently editing a good sized class in C# that has a ton of
I have an activity which is used for editing some object. Currently its layout
I'm using latexsuite with vim and I am currently editing files that have the
I want to develop dialog for editing objects that make use of polymorphism. Currently
I am currently editing a wordpress theme with custom field outputs. I have successfully
Currently, I am editing my production server's crons by typing crontab -e . I
I'm currently writing a script editing app in c# to edit game scripts. I

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.