ajax calls works, but only on second try
I'm trying to use the jqmodal dialog plugin and everything is working OK except for one minor problem. It seems when I click on the link, the expected action does not occur until I click the second time. Essentially I set up a small test form with a single line put into a table. In that data line is an href, which when clicked calls an AJAX function and returns text, which displays as a dialog. Like I said, this works fine except for the fact that the dialog does not show until the second time I click on the link. I added an alert box to the code, so I know the function is executed the first time the link is clicked, but I can't figure out how to fix the problem.
Could sure use some help. I have pasted the code below.
Tom
<script>
$().ready(function() {
$("#hrefClick").click(function(e) {
e.preventDefault();
var NoteID = $(this).attr('href');
hrefVal = 'displaynotedata.php?NoteID='+NoteID;
// alert(hrefVal);
$('#ex2').jqm({ajax: hrefVal, trigger: 'a.ex2trigger', modal:true, overlay: 25});
});
});
</script>
</head>
<body>
<form>
<table width="100% border="1">
<tr>
<td valign=top align=left ><a href="editnotes.php?ID=1751" target=_blank><img src="pencil.gif" border=0></a></td>
<td valign=top align=right ><img src=internal.gif border=0></td>
<td valign=top align=center ><img src=check.gif border=0></td><td valign=top align=left ></td>
<td valign=top align=left width=150 >
<a href="view_household.php?SSN=111-11-1111">Smith, David and Mary</a>
</td>
<td valign=top align=left >Smith</td>
<td valign=top align=left >
<b><a id="hrefClick" href="1751" name="IDhref" class="ex2trigger" > Oil change for Ford due <br><font color="#888888"></a></b></font>
</td>
</tr>
</table>
</form>
<div class="jqmWindow" id="ex2">
Please wait... <img src="inc/busy.gif" alt="loading" />
</div>
</body>
</html>