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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:30:29+00:00 2026-06-02T16:30:29+00:00

I would like to call a jquery ajax function and pass in data. I

  • 0

I would like to call a jquery ajax function and pass in data. I know the data is supposed to be formatted into a query string. If I pass in something like $(':checked') as the data then it will be formatted as tagname=value1&tagname=value2...etc which is good.

Now, I want to replace the jquery result with an associative array that has some integers in it i get value1=true$value2=true. That is not what I want.

How can I format the associative array with a key to pass into jquery ajax calls?

  • 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-02T16:30:30+00:00Added an answer on June 2, 2026 at 4:30 pm

    Ok, I’ve got one solution that I figured out. I created the following function which returns an array that can be passed in as data to jquery ajax function:

    function () {
        var kvArray = [];
        for (x in MyAssociativeArray) {
            var kv = {};
            kv.name = "NameIWantToAssign";
            kv.value = x;
            kvArray.push(kv);
        }
    
        return kvArray;
    };
    

    The trick is to use the .name and .value properties. I got the idea after reading the following jquery documentation:

    If the object passed is in an Array, it must be an array of objects in the format returned by .serializeArray()

    [{name:"first",value:"Rick"},
    {name:"last",value:"Astley"},
    {name:"job",value:"Rock Star"}]
    

    There’s probably a better way though. Please comment or provide another answer if you know.

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

Sidebar

Related Questions

I user jquery.ajax call to controller of asp.net mvc... I would like to show
I have the following Jquery ajax call but would like to put as the
I am making an ajax call with jquery like: $.ajax({ url: path/to/webservice.asmx beforeSend: function(xmlHTTPRequest)
I would like to have a function that returns the repsonseText of a jQuery.ajax()
I am building data for an ajax call. I am using jquery. my function(simplified)
I have a data set that that I would like to call in a
I have a vector of pointers. I would like to call a function for
I've got a pickerview. I would like to call a specific function each time
I have a function that issues an AJAX call (via jQuery). In the complete
I have a jQuery ajax call that looks like this: $.ajax({ type : 'GET',

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.