Javascript sur click d'un lien
Bonjour,
J'ai trouvé un script qui permet d'appeler une page modal depuis un bouton.
Script :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| $(function () {
$(".js-create-document").click(function () {
$.ajax({
url: 'createDocument/',
type: 'get',
dataType: 'json',
beforeSend: function () {
$("#modal-book").modal("show");
},
success: function (data) {
$("#modal-book .modal-content").html(data.html_form);
}
});
});
}); |
Le bouton :
Code:
1 2 3 4 5
|
<button type="button" class="btn js-create-document">
<span class="glyphicon glyphicon-plus"></span>
New book
</button> |
Je voudrais faire la même chose mais en cliquant sur un lien
Comment dois faire ?
Merci pour votre aide.