I have a php file:
$sql = mysql_query("SELECT id, name FROM table") or die(mysql_error());
if (mysql_num_rows($sql) > 0){
while($row = mysql_fetch_array($sql)){
echo "<div class=\"content-row\">
<div class=\"row-1\">".$row['id']."</div>
<div class=\"row-2\">".$row['name']."</div>
</div>;
}
}
In JS file:
success: funxction(data){ $(".content").html(data); }
In HTML file I have:
<div class="content">
// Here the ajax put the divs
</div>
How can I get the content of <div class="row-1"></div> or <div class="row-2"></div>
when I click on a button?
The button is situated out of .content
area. I clicked on a row, it is lighted and I click on button. When a clicked on button, I want to get the id and name div content where the row is lighted.
............................................. Update: I have this js code: http://pastebin.com/bjU8Kp3L
when I click on the button, check if a row was selected; if is not selected i receive an notification, if the row is selected i want to receive div content :)