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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:18:36+00:00 2026-06-01T06:18:36+00:00

Not too sure if I’m doing this right. It looks a bit more convoluted

  • 0

Not too sure if I’m doing this right. It looks a bit more convoluted than it needs to be. But I am trying to pull a specific piece of data out of a json array. I need several features of this data piece, and then I need to take the return, label the return, and pass it through a method at the bottom of success call.

$(document).ready(function() {
  if ( window.location.href.match(/customer_number/).length > 0) {

    $customer_id = window.location.href.split(/customer_number=/)[1];

    $.ajax({
      url: '/customers/filter.json',
      data: { id: $customer_id },
      dataType: 'json',
      success: function(data) {
        response($.map(data, function(row) {
          return {
            value: row.customer.name,
            customer_number: row.customer.customer_number,
            id: row.customer.id,
            name: row.customer.name,
            phone_number: row.customer.phone_number,
            email: row.customer.email,
            service_address: row.customer.service_address,
            service_city: row.customer.service_city,
            service_state: row.customer.service_state,
            service_zip_code: row.customer.service_zip_code,
            billing_adress: row.customer.billing_address,
            billing_city: row.customer.billing_city,
            billing_state: row.customer.billing_state,
            billing_zip_code: row.customer.billing_zip_code,
            primary_contact_name: row.customer.primary_contact ? row.customer.primary_contact.first_name + ' ' + row.customer.primary_contact.last_name : ''
          };
          render_customer(name_of_return);
          //                  ^^ Not sure how to label that return into an object.
        }));
      }
    });
  };
});
  • 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-01T06:18:37+00:00Added an answer on June 1, 2026 at 6:18 am

    You’re passing the returned object back to $.map‘s handling of the return values for the iteration function (it builds up those values in an array), and then handing that array into your response function. In JavaScript, when you’re calling a function (or returning a value out of one), you don’t give the arguments / return value names. In the case of arguments, it’s entirely positional. (The function definition may assign them names, but you don’t when you call them.) In the case of a return value, there is only ever one.

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

Sidebar

Related Questions

I suspect this applies to general ASP.Net too but I am not sure. If
Not too sure what to make of this, but program runs just fine in
I am not too sure the best way to word this, but what I
I'm not too sure how to explain this, but I will try. I have
I am trying to create a layout but I am not too sure how
Not too sure what's going on here as this doesn't seem like standard practise
Not too sure how to formulate my question and I hope that this is
I'm not too sure what is going on here, but sometimes a particular file
I just got a site to manage, but am not too sure about the
Not really too sure how to word this question, therefore if you don't particularly

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.