0
var getAccessValues = {};
$(function(){
    $('.toggle_checkbox').change(function() {
        if (check === null) {
        } else {
            if (this.name == check) {
                incr++;
            } else {
                incr = 1;
            }
        }
        var tval = $(this).val();
        check = this.name;

        if (!getAccessValues[this.name]) {
            getAccessValues[this.name] = [];
        }
        getAccessValues[this.name][incr] = tval;
    });
});

function display() {
    $.ajax({
        type: "POST",
        url: "/CRM_Spring/ViewAccessRights/multipleUpdate",
        data: "getRights="+getAccessValues,
        success: function(msg) {
            alert("successfully transfered");
        }
    }); 
}

I want to know if I am passing my getAccessValues object in the right way. Also, I want to know how to retrieve values from this object in my spring controller. Thanks in advance.

@RequestMapping(value="/multipleUpdate",method=RequestMethod.POST)
public String updateMultipleAccessRights(@RequestParam("getRights") String RightsArray)
{
}
  • I think that your ajax function is incorrect. Try to change `data: "getRights="+getAccessValues,` to `data : {getRights : getAccessValues }`. Also if you will provide your `` configuration, it will be helpful – andriy Jul 10 '15 at 09:18
  • @andriy -I also want to know how to get those values in spring controller. – user3849377 Jul 10 '15 at 10:08
  • You can get these values by setting `@RequestParam("getRights")` annotation, it will map `getRights` ajax parameter to `RightsArray`. Did you tried to change `data` as I've told in previous comment? You also may have a problems because of `url` that is why I've asked you to add `` configurations to the question. It must be defined in `web.xml` file of the project – andriy Jul 10 '15 at 11:07
  • @andriy-I did check changing the data field but still it doesn't work – user3849377 Jul 10 '15 at 11:11

0 Answers0