I wasn’t sure the best title for this one…
My overall goal for this project. There are certain documents that require an email be required to download them. Through asp.net I am binding a repeater and then with jquery removing the href and placing it in the rel tag until they add their email address.
$('a[data-email="True"]').each(function () {
var href = $(this).attr('href');
$(this).attr('href', '#_');
$(this).attr('rel', href);
});
The jquery checks to see if the data-email tag = “True” if it is then the bootstrap modal will pop up and via ajax the form calls a web method and adds the email to the database if it isn’t a duplicate.
$('.emailcheck').live("click", function (e) {
if ($(this).data("email") == "True") {
$('#emailModal').modal();
}
});
Upon success the modal will close and on each data-email="True" the link is added back to the href and the data-email is set to False
$('#emailModal').modal('hide');
$('body a[data-email="True"]').each(function () {
var reltag = $(this).attr('rel');
$(this).attr('href', reltag);
$(this).attr('data-email', 'False');
});
All of this happens successfully, and the email downloads upon another click. However, when I click the download link the modal still pops up.
Can someone please guide me to a solution as to why the modal is still popping up. Also in the success script is there a way to automatically trigger the download?
Try this – not much of a change but here’s a jsFiddle showing it should work
OnLoad Function
Click Event
Email Submit Function