我有一个 jQuery post 请求,它以 html 格式返回表格数据 这是 jQuery post
jQuery('#chem_search').submit(function(e){
e.preventDefault();
var itemcode=jQuery('[name="itemcode"]').val();
jQuery.post("chemical_search_query.php", {"itemcode":itemcode}, function(data) {
jQuery('#type2').html(data);
});
});
ajax请求返回的数据是这样的
echo "<div id='dar'><table class='s_report'><tr><th>Item Code</th><th>Description</th><th>Unit</th><th>Op. Stock</th><th>Recd. Qty</th><th>Total Receipts</th><th>Used Qty</th><th>Available Stock</th></tr>";
$sr_no=0;
while($row=mysql_fetch_array($result))
{
$dateform=explode('-',$row['recd_date']);
$dateform2=explode('-',$row['analysed_date']);
$dateform3=explode('-',$row['report_send']);
echo "<td><div id='itemcode'>" . $row['item_code']. "</div></td>";
echo "<td>" . $row['description'] . "</td>";
echo "<td>" . $row['uom'] . "</td>";
echo "<td>" . $row['open_stock'] . "</td>";
echo "<td>" . $row['recd_total'] . "</td>";
echo "<td>" . $sum=$row['open_stock']+$row['recd_total'] . "</td>";
echo "<td><div id='iss'>" . $row['issue_qty'] . "</div></td>";
echo "<td>" . $available=$sum-$row['issue_qty'] . "</td>";
echo "</tr>";
}
echo "</table></div>";}
当我单击 div“iss”时,我想获取 div“itemcode”的内容。我知道如何获取被点击的 div 的内容。但这不是要求。有什么选择吗?