1

I want to open jquery dialogue box with unique id. But i cannot figure it out. Problem is that its not opening using unique identifier. i want to open it using id attribute.In other words i want to uniquely identify a link click and div/dialogue box. Anyone help please.

what i did is:

Javascript code:

$(function() {
    $(".dialog").dialog({
        autoOpen: false,
        maxWidth:600,
        maxHeight: 500,
        width: 600,
        height: 300,
        dialogClass: 'main-dialog-class',
        modal: true 
    });

    $("a.To").on("click", function() {
        var ID=$(this).attr('id');
        alert(ID);
        $(this).parent().find(".dialog").dialog("open");
    });
});

Php code.

<table>

<?php foreach($tList as $ts) : ?>
<tr>
<td>
    <div class="dialog" id="<?php echo $tenders["Tender_ID"]; ?>" title="Dialog Form">

    <?php  
        $sql1="select * from table where ID='".$ts["ID"]."'" ;
        $result1=mysqli_query($link,$sql1);
        while($rows=mysqli_fetch_array($result1)){
            echo $rows["t1"];
    ?>
    <a href="Download.php?filename=<?php echo $rows['Path'] ;?>" target="_blank"><?php echo $rows['Name'];?></a><br/>
    <?php } ?>
    </div>
</td>

<td style="display:none">
    <?php echo $ts["ID"]; ?>
</td>
<td>
    <a href="#" class="To" id="<?php echo $tenders["Tender_ID"]; ?>" >
                               <?php echo $tenders["Title"]; ?></a>
</td>
<td>
    <?php echo $ts["t1"]; ?>
</td>
<td>
    <?php echo $ts["t2"]; ?>
</td>
</tr>


<?php endforeach; ?>
</table>
TheGr8_Nik
  • 3,080
  • 4
  • 18
  • 33
sam
  • 39
  • 6
  • don't use jQuery to get the id, `$(this).attr('id')` should be `this.id` – TheGr8_Nik May 31 '15 at 07:09
  • the alert is not problem problem is that dialogue box is not opening using unique id. – sam May 31 '15 at 07:17
  • have a look at (http://stackoverflow.com/questions/12533926/are-class-names-in-css-selectors-case-sensitive) - perhaps question the use of To as a class selector, a more specific and more descriptive (and lowercase) label for your selector is probably a good idea. – Nicholas Alexander May 31 '15 at 07:46
  • how we can do this using ajax means can we get the database data in dialogue box using ajax ??? – sam May 31 '15 at 10:01
  • i am using all the tactics but not working :( – sam May 31 '15 at 10:38

0 Answers0