Tuesday, 17 September 2013

How to get content of an element in the html returned by jquery post

How to get content of an element in the html returned by jquery post

I have a jQuery post request which return a tabular data in html format
This is the 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);
});
});
the data returned by the ajax request is like this
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>";}
I want to get content of the div "itemcode" when I click on the div "iss".
I know how to get content of the div which is clicked. But that is not the
requirement. Any option?

No comments:

Post a Comment