[jQuery] Problem jqm and $.get

[jQuery] Problem jqm and $.get


hi,
I am having problem when I use the $.get and jqm.
I developed a easy example about the problem, you can download it
from:
http://cid-5c82aa0c9bbaf5b3.skydrive.live.com/self.aspx/Public/Forum/WebAppjQuery.zip
When the example run, you can see a default.aspx page with two
buttons.
You need to press the LoadGrid button.
When the grid is loaded at the first time you can press the cancel
buttons and you will see a popup windows.
But when you press LoadGrid button again, the grid will be reload but
the popup doesn´t work.
If you press the button "Add Event" the trigger will be reasigned and
the popup works again.
I don´t understand, why the trigger parameter in the jqm doesn´t work
when the grid is reloaded, but the jqmAddTrigger() works without
problems ?
if I use the code in this manner, the popup work the first time:
<script language="javascript" type="text/javascript">
var reloadnumber = 0;
function getGrid() {
$.get("Grid.aspx",
{
reloadcounter: reloadnumber
},
function(data) {
$("#grid-information").html(data);
registerPopUp();
});
reloadnumber++;
}
function registerPopUp() {
$('#popup-info').jqm({
trigger: 'a.linkcancel',
modal: true,
overlay: 50
});
}
function AddEvent() {
$("#popup-info").jqmAddTrigger("a.linkcancel")
}
</script>
but if I use the code :
<script language="javascript" type="text/javascript">
var reloadnumber = 0;
function getGrid() {
$.get("Grid.aspx",
{
reloadcounter: reloadnumber
},
function(data) {
$("#grid-information").html(data);
registerPopUp();
});
reloadnumber++;
}
function registerPopUp() {
$('#popup-info').jqm({
//trigger: 'a.linkcancel',
modal: true,
overlay: 50
});
$("#popup-info").jqmAddTrigger("a.linkcancel")
}
function AddEvent() {
$("#popup-info").jqmAddTrigger("a.linkcancel")
}
</script>
This works always
The difference is like the trigger is registered.
somebody knows, why is it ?
greetings