我不知道... :-( 如何选择具有名称 + 变量的元素(对应的注释 id)
HTML:
<div class="editable" id="tiny_12">blablabla</div>
<input type="button" class="bouton_save_ajax" id="sauver_billet_html_12">
<div class="editable" id="tiny_13">blablabla</div>
<input type="button" class="bouton_save_ajax" id="sauver_billet_html_13">
<div class="editable" id="tiny_14">blablabla</div>
<input type="button" class="bouton_save_ajax" id="sauver_billet_html_14">
...
...
和 javascript (Jquery):
$(document).ready(function () {
$("#sauver_billet_html_12").click(function (event) {
var bufferId = {};
bufferId['html'] = $("#tiny_12").html();
// bufferId['id'] = 12;
$.ajax({
type: "POST",
url: "ajax_save_post",
data: bufferId,
dataType: "html",
success: function (data) {
alert(event.target.id);
}
});
});
});
谢谢