i have one hyperlink names it works fine
and it has class "cancel-from-record-to-exam".
Please don't notice at the class name.
And the problem looks next: When i'm click on 'it works fine' it give me good result (change div in success action), but when i'm trying to click on the button, which has just appeared in div - then i can't see any action (nothing! even not alert('alert')) for this hyperlink. How can I resolve it?
<div id='loadingmessage' style=''>
loading...
</div>
<a class="cancel-from-record-to-exam" data-id=19>it works fine</a>
@section Scripts {
<script type="text/javascript">
$("a.cancel-from-record-to-exam").click(function (event) {
alert('alert');
var requestForm = $('#loadingmessage');
$.ajax({
url: '/Test/GetProducts',
contentType: 'application/html; charset=utf-8',
data: { id: $(this).data("id") },
type: 'GET',
dataType: 'html'
})
.success(function (result) {
alert('ok');
requestForm.html('<a class="cancel-from-record-to-exam" data-id=19>here's the new button and it doesn't any actions</a>');
})
.error(function (xhr, status, throwError) {
alert('bad');
})
});
</script>
}