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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:56:52+00:00 2026-06-17T22:56:52+00:00

I hava a jQuery ajax call like this: var arr = [a, b, c];

  • 0

I hava a jQuery ajax call like this:

var arr = ["a", "b", "c"];
$.get("/test", {testArray: arr}, function(data) {
    alert(data);
});

server side:

@RequestMapping(value = "/test", method = RequestMethod.GET)
public String addAnotherAppointment(
        HttpServletRequest request,
        HttpServletResponse response,
                    @RequestParam("arr") arr,
        Model model,
        BindingResult errors) {
}

So how do I receive the parameter?

Thanks.

  • 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-17T22:56:53+00:00Added an answer on June 17, 2026 at 10:56 pm

    If you use spring 3.0++,use “@ResponseBody” annotation.

    Do you want to send a json request, and receive a response from json?
    If so, you’ll change your code like this.

    var list = {testArray:["a", "b", "c"]};
    $.ajax({
        url : '/test',
        data : $.toJSON(list),
        type : 'POST', //<== not 'GET',
        contentType : "application/json; charset=utf-8",
        dataType : 'json',
        error : function() {
            console.log("error");
        },
        success : function(arr) {
            console.log(arr.testArray);
            var testArray = arr.testArray;
             $.each(function(i,e) {
                 document.writeln(e);
             });
        }
      });
    

    server side:

    1. create your own “Arr” class.

      public class Arr {
       private List<String> testArray;
       public void setTestArray(List<String> testArray) {
           this.testArray = testArray;
       }
       public List<String> getTestArray() {
           return testArray;
       }
       }
      

      and

      @RequestMapping(value = "/test", method = RequestMethod.POST)
      @ResponseBody// <== this annotation will bind Arr class and convert to json response.
         public Arr addAnotherAppointment(
         HttpServletRequest request,
          HttpServletResponse response,
          @RequestBody Arr arr, 
          Model model,
          BindingResult errors) {
              return arr;
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i hava a c++ method(for java,jni) like follow,when i repeat call this from java
I hava ajax call and I am getting the data back correctly. But i
I hava a data structure that looks like this: (def conf { :devices [{:alias
I hava a binary file like this : offset | size/type | Description -------+-----------+-----------------------------------------------------------
I hava a jquery mobile slider. <input type=range min=1 max=100 data-theme=d data-highlight=true/> My question
I hava text file full of values like this: The first line is a
I hava a class like this: public class tbl050701_1391_Fields { public static readonly string
I hava a functoin that call himself occasionally, that function has some asynchronous call
I hava an activity which might have to load data when it's starting up.
I hava a xml doc (and complex element) that is similar to this example:

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.