enter link description here我有以下jquery ajax,其中包含点击细胞后的div页面:
$(function () {
$('.yo').click(function (e) {
e.preventDefault();
var value = $('#prodajx').val();
var value1 = $('#cityajx').val();
var value2 = $('#regionajx').val();
$.post('demo_link_table_static.php', {value: value, value1: value1, value2: value2}, function (data) {
$("#search_results").html(data);
});
return false;
});
});
现在我想在ajax post方法中使用id
td ...如何获得id
td
(点击后)并将其发布到另一个页面?谢谢。
答案 0 :(得分:0)
var id_current = $(this).attr('id');
var id_0 = $('#prodajx').attr('id');
var id_1 = $('#cityajx').attr('id');
var id_2 = $('#regionajx').attr('id');
答案 1 :(得分:0)
$(function () {
$('.yo').click(function (e) {
e.preventDefault();
var value = $('#prodajx').val();
var value1 = $('#cityajx').val();
var value2 = $('#regionajx').val();
var id_td = $(this).attr('id');
$.ajax({
url: "demo_link_table_static.php",
type: "POST",
data : "id_td="+id_td+"&value="+value+"&value1="+value1+"&value2="+value2,
success:function(data){
$("#search_results").html(data);
}
});
return false;
});
});