Reputation:
I have a button, like so:
<a data-toggle="modal" href="#influencerModal" class="btn btn-primary influencer-card">Influencer Profile</a>
When I click it, I want the modal to not open, so that I can ajax some content into it, then manually open it with .modal()
.
Not seeing many helpful items online about this idea of stopping it AFTER the button to open it has been clicked.
Any questions, just ask below.
Upvotes: 7
Views: 7455
Reputation: 2169
Remove data-toggle="modal
attribute from :
<a data-toggle="modal" href="#influencerModal" class="btn btn-primary influencer-card">Influencer Profile</a>
Instead add onclick="function_call()"
attribute, so that you can call AJAX
in that JS function. After AJAX success you can open model like below :
$('#your_modal_id').modal("show");
You can refer SO question.
Also refer w3schools.com page.
Upvotes: 10
Reputation: 546
Remove this attribute from the link data-toggle="modal"
Then use this in the script wherever you want the modal to be triggered
$('#modal').modal("show")
Upvotes: 3