发送点击的按钮ID AJAX

I'd like to send series["id"+i] to write.php. (This code is in another ajax request.) Any idea?

series = new Object();
$(xml_node).find("Series").each(function (i) {
    series["id" + i] = $(this).find("seriesid").text();
    series["name" + i] = $(this).find("SeriesName").text();
    series["banner" + i] = $(this).find("banner").text();
    table += '<tr<td>' + series["banner" + i] + '</td>' + '<td>' + series["name" + i] +
        '</td>' + '<td>' + '<button>Add show</button>' + '</td>' + '</tr>';
});
$('button').click(function addseries() {
    $.ajax({
        type: "POST",
        url: 'write.php',
        data: series["id" + i],
        success: function (data) {
            console.log(data);
        }
    });
});

You can get the event of what triggered the ajax call,

for example

$('button').click(function addseries(e){
console.log($(e.target));
}

where $(e.target) is the jQuery object that triggered the call.

You can also use $(this)(referring to the jQuery object that called the function).

so in our example,

$('button').click(function addseries(e){
console.log( $(this).attr('id') );
});
...'<button data-id="' + i +'">Add show</button>'..


$('button').click(function addseries(e){
   var i = $(e.currentTarget).attr('data-id');
   $.ajax({
      type: "POST",
     url: 'write.php',
     data: i,
     success: function(data) {
     console.log(data);
   }
}); 

UPDATE:

data: {id: i}

or

data: 'id=' + i