Q: Set data title generic ajax   $( document ).ready(function(){

    $('.status-red').click(function(){
        var colonne_id = $('.status-red').attr('data-sort');
        data = {sort: colonne_id , '+name': $('.search-query').val()};
        console.log(data);
        $.ajax({
            url: $('.url_sortindex').val(),
            data: data,
            type: 'post',
            dataType: "json",
            success: function(data) {
                $('#body_sortindex').html(data.content);
            }
        });
    });
});

Hi,
I have a search with this input. 
<input type="text" value="test" placeholder="name" class="input-medium search-query form-control" name="+name" style="margin-right:5px">

But you see the name of this input name="+name".
My problem is, If I create a new input named "age" for example my request ajax don't work because the name is "+name". My question is, how do you set the name for example like that 
data = {sort: colonne_id , $('.search-query').attr('name'): $('.search-query').val()};

I need to get the name of my input like that $('.search-query').attr('name')
And set my title here data = {sort: colonne_id , '+name': $('.search-query').val()};
I want to set +name in data to$('.search-query').attr('name')
I don't want the name in data is + name but a variable
I want to make my input generic.
Thanks you ;)

A: You can try this way:
var data = {};

data['sort'] = colonne_id;
data[$('.search-query').attr('name')] = $('.search-query').val();

This should work. Hope it helps.
