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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:45:04+00:00 2026-06-17T07:45:04+00:00

I have the following serialized data string (Some of the contents are from checkboxes

  • 0

I have the following serialized data string (Some of the contents are from checkboxes so that is why the ‘brand’ is repeated) coming from another page:

brand=Ford&brand=Dodge&brand=Mazda&year=2013&type=compact

and I would like to populate the div tag with the id of “results”:

<div id="results">    
    <div id="brand"></div>    
    <div id="year"></div>    
    <div id="type"></div>    
</div>

I’m currently using this code to loop over the data:

$.each(SelectionData.split('&'), function (index, elem) {    
    var vals = elem.split('=');    
    $('#' + vals[0]).text(decodeURIComponent(vals[1].replace(/\+/g, ' ')));    
});

It has been working fine until we added checkboxes to the form. Now I’m only able to display the last value in a string when the names are the same as show here:

This is what we have now

<div id="results">
    <div id="brand">Mazda</div>    
    <div id="year">2013</div>    
    <div id="type">compact</div>    
</div>    

This is what we are looking for:

<div id="results">
    <div id="brand">Ford,Dodge,Mazda</div>    
    <div id="year">2013</div>    
    <div id="type">compact</div>    
</div>
  • 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-17T07:45:05+00:00Added an answer on June 17, 2026 at 7:45 am

    I don’t understand why you want the result to be formatted inside a div called results but your code attempts to change the text of a element with an id equaliing the name of the uri paramter name.

    Anyway I think I’ve figured out what you want to do. Working Demo

    The HTML:

    <div id="brand"></div>
    <div id="year"></div>
    <div id="type"></div>
    

    The Code:

    var SelectionData = 'brand=Ford&brand=Dodge&brand=Mazda&year=2013&type=compact';
    
    $.each(SelectionData.split('&'), function (index, elem) {
        var vals = elem.split('=');
        var $div = $("#"+vals[0]);
        var separator = '';
        if ($div.html().length > 0) {
            separator = ', ';
        }
        $div.html($div.html() + separator + decodeURIComponent(vals[1].replace(/\+/g, '  ')));
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following php code that gets a serialized array from a mysql
I have the following data structure: [DataServiceEntity] public class User { public string RowKey
I have the following serialized PHP array stored in a mySQL database: a:2:{i:2070;s:4:0.00;i:1901;s:4:1.00;} Now,
I have the following code that serializes a DataTable to XML. StringWriter sw =
i have the following code: public static void Serialize() { List<string> dirs = FileHelper.GetFilesRecursive(fileDirectoryPath);
I have following div in a page (I can not modify). <div id=:0.control>Click me</div>
I have a program that parses some XML using XML::Simple . It appears at
I have been trying to serialize some json data in Silverlight. I am using
I have to insert some data into a MySQL table. The data will be
I'm implementing a custom data provider, I have gotten it to the point that

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.