click function called multiple times
The thing is there are various products on my homepage , on clicking on it there is a popup opening after it. There is a like button on the modal popup. On clicking on it i fire ajax and populate the database and close it , but when i open another popup model and click on the like button the ajax fires two times similarly after closing and opening another popup the ajax call increases.
I tried to make modal html to blank on clicking the close button on button. but, it is not working.
On the home page
<div class="container">
<div class="prod_detail">
<div class="modal fade" id="prod_viewd" role="dialog">
</div>
</div>
</div>
this is the container where i am populating the data .
This is the like icon html
<a href="javascript:void(0);" class="vf-item-fullview-icon change">
<span class="ProductFullView_like lstCng">
<img src="<?php echo base_url(); ?>assets/blog/feed_image/likeBlack.png" />
</span>
</a>
and this is the code for click
$(document.body).on('click','.change', function(e) {
alert('clicked');
$.ajax({
url: base_url + 'Like',
type: 'POST',
data: "product_id=" + $('#product_id').val() + "&from=product",
dataType: "json",
success: function (response)
{
if (response.exists == "1")
{
//$('#success_wish').html(response.message);
//$('#success_wish').show("slow");
// $('.hello').attr('src', swap).attr("data",current);
$(".product_like_li").html(response.likeText);
window.setTimeout(function () {
$('#success_wish').hide("slow")
}, 3000);
}
if (response.exists == "2")
{
//$('#success_error').html(response.message);
//$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
window.setTimeout(function () {
window.location.href = base_url + 'Login'
}, 3000);
}
if (response.exists == "0")
{
$('#success_error').html(response.message);
$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
}
}
});
});
jquery
|
show 5 more comments
The thing is there are various products on my homepage , on clicking on it there is a popup opening after it. There is a like button on the modal popup. On clicking on it i fire ajax and populate the database and close it , but when i open another popup model and click on the like button the ajax fires two times similarly after closing and opening another popup the ajax call increases.
I tried to make modal html to blank on clicking the close button on button. but, it is not working.
On the home page
<div class="container">
<div class="prod_detail">
<div class="modal fade" id="prod_viewd" role="dialog">
</div>
</div>
</div>
this is the container where i am populating the data .
This is the like icon html
<a href="javascript:void(0);" class="vf-item-fullview-icon change">
<span class="ProductFullView_like lstCng">
<img src="<?php echo base_url(); ?>assets/blog/feed_image/likeBlack.png" />
</span>
</a>
and this is the code for click
$(document.body).on('click','.change', function(e) {
alert('clicked');
$.ajax({
url: base_url + 'Like',
type: 'POST',
data: "product_id=" + $('#product_id').val() + "&from=product",
dataType: "json",
success: function (response)
{
if (response.exists == "1")
{
//$('#success_wish').html(response.message);
//$('#success_wish').show("slow");
// $('.hello').attr('src', swap).attr("data",current);
$(".product_like_li").html(response.likeText);
window.setTimeout(function () {
$('#success_wish').hide("slow")
}, 3000);
}
if (response.exists == "2")
{
//$('#success_error').html(response.message);
//$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
window.setTimeout(function () {
window.location.href = base_url + 'Login'
}, 3000);
}
if (response.exists == "0")
{
$('#success_error').html(response.message);
$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
}
}
});
});
jquery
I think the problem comes from the way you name the element. Maybe you have multiple elements which have the same class name. That's how: I do this, but why that?
– Foo
Nov 19 '18 at 9:54
@TânNguyễn i have already checked that , i think when i click to open the modal the number of instances of modal = number of ajax called
– Sanjit Bhardwaj
Nov 19 '18 at 9:56
you sample code is not enough to understand, maybe it's something related to how you add the event listener...
– Plastic
Nov 19 '18 at 9:57
can you show your html or better to make a fiddle for it
– Negi Rox
Nov 19 '18 at 10:00
1
i would suggest to bind a click function on page load
– Negi Rox
Nov 19 '18 at 10:11
|
show 5 more comments
The thing is there are various products on my homepage , on clicking on it there is a popup opening after it. There is a like button on the modal popup. On clicking on it i fire ajax and populate the database and close it , but when i open another popup model and click on the like button the ajax fires two times similarly after closing and opening another popup the ajax call increases.
I tried to make modal html to blank on clicking the close button on button. but, it is not working.
On the home page
<div class="container">
<div class="prod_detail">
<div class="modal fade" id="prod_viewd" role="dialog">
</div>
</div>
</div>
this is the container where i am populating the data .
This is the like icon html
<a href="javascript:void(0);" class="vf-item-fullview-icon change">
<span class="ProductFullView_like lstCng">
<img src="<?php echo base_url(); ?>assets/blog/feed_image/likeBlack.png" />
</span>
</a>
and this is the code for click
$(document.body).on('click','.change', function(e) {
alert('clicked');
$.ajax({
url: base_url + 'Like',
type: 'POST',
data: "product_id=" + $('#product_id').val() + "&from=product",
dataType: "json",
success: function (response)
{
if (response.exists == "1")
{
//$('#success_wish').html(response.message);
//$('#success_wish').show("slow");
// $('.hello').attr('src', swap).attr("data",current);
$(".product_like_li").html(response.likeText);
window.setTimeout(function () {
$('#success_wish').hide("slow")
}, 3000);
}
if (response.exists == "2")
{
//$('#success_error').html(response.message);
//$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
window.setTimeout(function () {
window.location.href = base_url + 'Login'
}, 3000);
}
if (response.exists == "0")
{
$('#success_error').html(response.message);
$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
}
}
});
});
jquery
The thing is there are various products on my homepage , on clicking on it there is a popup opening after it. There is a like button on the modal popup. On clicking on it i fire ajax and populate the database and close it , but when i open another popup model and click on the like button the ajax fires two times similarly after closing and opening another popup the ajax call increases.
I tried to make modal html to blank on clicking the close button on button. but, it is not working.
On the home page
<div class="container">
<div class="prod_detail">
<div class="modal fade" id="prod_viewd" role="dialog">
</div>
</div>
</div>
this is the container where i am populating the data .
This is the like icon html
<a href="javascript:void(0);" class="vf-item-fullview-icon change">
<span class="ProductFullView_like lstCng">
<img src="<?php echo base_url(); ?>assets/blog/feed_image/likeBlack.png" />
</span>
</a>
and this is the code for click
$(document.body).on('click','.change', function(e) {
alert('clicked');
$.ajax({
url: base_url + 'Like',
type: 'POST',
data: "product_id=" + $('#product_id').val() + "&from=product",
dataType: "json",
success: function (response)
{
if (response.exists == "1")
{
//$('#success_wish').html(response.message);
//$('#success_wish').show("slow");
// $('.hello').attr('src', swap).attr("data",current);
$(".product_like_li").html(response.likeText);
window.setTimeout(function () {
$('#success_wish').hide("slow")
}, 3000);
}
if (response.exists == "2")
{
//$('#success_error').html(response.message);
//$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
window.setTimeout(function () {
window.location.href = base_url + 'Login'
}, 3000);
}
if (response.exists == "0")
{
$('#success_error').html(response.message);
$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
}
}
});
});
jquery
jquery
edited Nov 19 '18 at 10:07
Sanjit Bhardwaj
asked Nov 19 '18 at 9:50
Sanjit BhardwajSanjit Bhardwaj
399111
399111
I think the problem comes from the way you name the element. Maybe you have multiple elements which have the same class name. That's how: I do this, but why that?
– Foo
Nov 19 '18 at 9:54
@TânNguyễn i have already checked that , i think when i click to open the modal the number of instances of modal = number of ajax called
– Sanjit Bhardwaj
Nov 19 '18 at 9:56
you sample code is not enough to understand, maybe it's something related to how you add the event listener...
– Plastic
Nov 19 '18 at 9:57
can you show your html or better to make a fiddle for it
– Negi Rox
Nov 19 '18 at 10:00
1
i would suggest to bind a click function on page load
– Negi Rox
Nov 19 '18 at 10:11
|
show 5 more comments
I think the problem comes from the way you name the element. Maybe you have multiple elements which have the same class name. That's how: I do this, but why that?
– Foo
Nov 19 '18 at 9:54
@TânNguyễn i have already checked that , i think when i click to open the modal the number of instances of modal = number of ajax called
– Sanjit Bhardwaj
Nov 19 '18 at 9:56
you sample code is not enough to understand, maybe it's something related to how you add the event listener...
– Plastic
Nov 19 '18 at 9:57
can you show your html or better to make a fiddle for it
– Negi Rox
Nov 19 '18 at 10:00
1
i would suggest to bind a click function on page load
– Negi Rox
Nov 19 '18 at 10:11
I think the problem comes from the way you name the element. Maybe you have multiple elements which have the same class name. That's how: I do this, but why that?
– Foo
Nov 19 '18 at 9:54
I think the problem comes from the way you name the element. Maybe you have multiple elements which have the same class name. That's how: I do this, but why that?
– Foo
Nov 19 '18 at 9:54
@TânNguyễn i have already checked that , i think when i click to open the modal the number of instances of modal = number of ajax called
– Sanjit Bhardwaj
Nov 19 '18 at 9:56
@TânNguyễn i have already checked that , i think when i click to open the modal the number of instances of modal = number of ajax called
– Sanjit Bhardwaj
Nov 19 '18 at 9:56
you sample code is not enough to understand, maybe it's something related to how you add the event listener...
– Plastic
Nov 19 '18 at 9:57
you sample code is not enough to understand, maybe it's something related to how you add the event listener...
– Plastic
Nov 19 '18 at 9:57
can you show your html or better to make a fiddle for it
– Negi Rox
Nov 19 '18 at 10:00
can you show your html or better to make a fiddle for it
– Negi Rox
Nov 19 '18 at 10:00
1
1
i would suggest to bind a click function on page load
– Negi Rox
Nov 19 '18 at 10:11
i would suggest to bind a click function on page load
– Negi Rox
Nov 19 '18 at 10:11
|
show 5 more comments
4 Answers
4
active
oldest
votes
Try to unbind the click event whenever page loads.You can use unbind method as follows.
$(document).unbind('click');
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 9:59
it will not work.
– Negi Rox
Nov 19 '18 at 10:00
add a comment |
Try to use off to unbind the events:
$('.commonClose').off('click').click(function(e) {
$('.prod_vbody').html('');
})
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
add a comment |
Try like below. It seems that $(document.body).on
event is getting bind each time you open popup.
$(document.body).off('click','.change');
$(document.body).on('click','.change', function(e) {
// Your code
});
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
add a comment |
please add your function on document.ready function something like this.
$(document).ready(function(){
$('.change').on('click', function(e) {
alert('clicked');
$.ajax({
url: base_url + 'Like',
type: 'POST',
data: "product_id=" + $('#product_id').val() + "&from=product",
dataType: "json",
success: function (response)
{
if (response.exists == "1")
{
//$('#success_wish').html(response.message);
//$('#success_wish').show("slow");
// $('.hello').attr('src', swap).attr("data",current);
$(".product_like_li").html(response.likeText);
window.setTimeout(function () {
$('#success_wish').hide("slow")
}, 3000);
}
if (response.exists == "2")
{
//$('#success_error').html(response.message);
//$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
window.setTimeout(function () {
window.location.href = base_url + 'Login'
}, 3000);
}
if (response.exists == "0")
{
$('#success_error').html(response.message);
$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
}
}
});
});
})
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372008%2fclick-function-called-multiple-times%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try to unbind the click event whenever page loads.You can use unbind method as follows.
$(document).unbind('click');
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 9:59
it will not work.
– Negi Rox
Nov 19 '18 at 10:00
add a comment |
Try to unbind the click event whenever page loads.You can use unbind method as follows.
$(document).unbind('click');
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 9:59
it will not work.
– Negi Rox
Nov 19 '18 at 10:00
add a comment |
Try to unbind the click event whenever page loads.You can use unbind method as follows.
$(document).unbind('click');
Try to unbind the click event whenever page loads.You can use unbind method as follows.
$(document).unbind('click');
answered Nov 19 '18 at 9:55
Anupam BhattAnupam Bhatt
574
574
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 9:59
it will not work.
– Negi Rox
Nov 19 '18 at 10:00
add a comment |
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 9:59
it will not work.
– Negi Rox
Nov 19 '18 at 10:00
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 9:59
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 9:59
it will not work.
– Negi Rox
Nov 19 '18 at 10:00
it will not work.
– Negi Rox
Nov 19 '18 at 10:00
add a comment |
Try to use off to unbind the events:
$('.commonClose').off('click').click(function(e) {
$('.prod_vbody').html('');
})
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
add a comment |
Try to use off to unbind the events:
$('.commonClose').off('click').click(function(e) {
$('.prod_vbody').html('');
})
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
add a comment |
Try to use off to unbind the events:
$('.commonClose').off('click').click(function(e) {
$('.prod_vbody').html('');
})
Try to use off to unbind the events:
$('.commonClose').off('click').click(function(e) {
$('.prod_vbody').html('');
})
answered Nov 19 '18 at 10:08
Jose G.Jose G.
3216
3216
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
add a comment |
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
add a comment |
Try like below. It seems that $(document.body).on
event is getting bind each time you open popup.
$(document.body).off('click','.change');
$(document.body).on('click','.change', function(e) {
// Your code
});
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
add a comment |
Try like below. It seems that $(document.body).on
event is getting bind each time you open popup.
$(document.body).off('click','.change');
$(document.body).on('click','.change', function(e) {
// Your code
});
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
add a comment |
Try like below. It seems that $(document.body).on
event is getting bind each time you open popup.
$(document.body).off('click','.change');
$(document.body).on('click','.change', function(e) {
// Your code
});
Try like below. It seems that $(document.body).on
event is getting bind each time you open popup.
$(document.body).off('click','.change');
$(document.body).on('click','.change', function(e) {
// Your code
});
edited Nov 19 '18 at 10:16
answered Nov 19 '18 at 10:07
KaranKaran
3,0902324
3,0902324
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
add a comment |
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
it is not working
– Sanjit Bhardwaj
Nov 19 '18 at 10:10
add a comment |
please add your function on document.ready function something like this.
$(document).ready(function(){
$('.change').on('click', function(e) {
alert('clicked');
$.ajax({
url: base_url + 'Like',
type: 'POST',
data: "product_id=" + $('#product_id').val() + "&from=product",
dataType: "json",
success: function (response)
{
if (response.exists == "1")
{
//$('#success_wish').html(response.message);
//$('#success_wish').show("slow");
// $('.hello').attr('src', swap).attr("data",current);
$(".product_like_li").html(response.likeText);
window.setTimeout(function () {
$('#success_wish').hide("slow")
}, 3000);
}
if (response.exists == "2")
{
//$('#success_error').html(response.message);
//$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
window.setTimeout(function () {
window.location.href = base_url + 'Login'
}, 3000);
}
if (response.exists == "0")
{
$('#success_error').html(response.message);
$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
}
}
});
});
})
add a comment |
please add your function on document.ready function something like this.
$(document).ready(function(){
$('.change').on('click', function(e) {
alert('clicked');
$.ajax({
url: base_url + 'Like',
type: 'POST',
data: "product_id=" + $('#product_id').val() + "&from=product",
dataType: "json",
success: function (response)
{
if (response.exists == "1")
{
//$('#success_wish').html(response.message);
//$('#success_wish').show("slow");
// $('.hello').attr('src', swap).attr("data",current);
$(".product_like_li").html(response.likeText);
window.setTimeout(function () {
$('#success_wish').hide("slow")
}, 3000);
}
if (response.exists == "2")
{
//$('#success_error').html(response.message);
//$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
window.setTimeout(function () {
window.location.href = base_url + 'Login'
}, 3000);
}
if (response.exists == "0")
{
$('#success_error').html(response.message);
$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
}
}
});
});
})
add a comment |
please add your function on document.ready function something like this.
$(document).ready(function(){
$('.change').on('click', function(e) {
alert('clicked');
$.ajax({
url: base_url + 'Like',
type: 'POST',
data: "product_id=" + $('#product_id').val() + "&from=product",
dataType: "json",
success: function (response)
{
if (response.exists == "1")
{
//$('#success_wish').html(response.message);
//$('#success_wish').show("slow");
// $('.hello').attr('src', swap).attr("data",current);
$(".product_like_li").html(response.likeText);
window.setTimeout(function () {
$('#success_wish').hide("slow")
}, 3000);
}
if (response.exists == "2")
{
//$('#success_error').html(response.message);
//$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
window.setTimeout(function () {
window.location.href = base_url + 'Login'
}, 3000);
}
if (response.exists == "0")
{
$('#success_error').html(response.message);
$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
}
}
});
});
})
please add your function on document.ready function something like this.
$(document).ready(function(){
$('.change').on('click', function(e) {
alert('clicked');
$.ajax({
url: base_url + 'Like',
type: 'POST',
data: "product_id=" + $('#product_id').val() + "&from=product",
dataType: "json",
success: function (response)
{
if (response.exists == "1")
{
//$('#success_wish').html(response.message);
//$('#success_wish').show("slow");
// $('.hello').attr('src', swap).attr("data",current);
$(".product_like_li").html(response.likeText);
window.setTimeout(function () {
$('#success_wish').hide("slow")
}, 3000);
}
if (response.exists == "2")
{
//$('#success_error').html(response.message);
//$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
window.setTimeout(function () {
window.location.href = base_url + 'Login'
}, 3000);
}
if (response.exists == "0")
{
$('#success_error').html(response.message);
$('#success_error').show("slow");
window.setTimeout(function () {
$('#success_error').hide("slow")
}, 3000);
}
}
});
});
})
edited Nov 19 '18 at 10:18
answered Nov 19 '18 at 10:12
Negi RoxNegi Rox
1,7051511
1,7051511
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372008%2fclick-function-called-multiple-times%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think the problem comes from the way you name the element. Maybe you have multiple elements which have the same class name. That's how: I do this, but why that?
– Foo
Nov 19 '18 at 9:54
@TânNguyễn i have already checked that , i think when i click to open the modal the number of instances of modal = number of ajax called
– Sanjit Bhardwaj
Nov 19 '18 at 9:56
you sample code is not enough to understand, maybe it's something related to how you add the event listener...
– Plastic
Nov 19 '18 at 9:57
can you show your html or better to make a fiddle for it
– Negi Rox
Nov 19 '18 at 10:00
1
i would suggest to bind a click function on page load
– Negi Rox
Nov 19 '18 at 10:11