Button click ajax call firing multiple times in mvc4?
Hello Sir,<br /><br />After this ('#btn_rightArw_Dwn') button click ajax call firing multiple times in mvc4. why this is happening? Please look up on below jQuery code.<br /><br />$("#btn_rightArw_Dwn").unbind().click(function () { <br /> alert('hi')<br /> var Masterid = $('#MastersId').val();<br /> var pgm_id = $('#program1').val();<br /> if ($('#rdclick').val() == "0") { <br /> alert('got')<br /> $.ajax({<br /><br /> beforeSend: function () {<br /> setTimeout(function () {<br /> $('.fade_bg').show();<br /> }, 0.1);<br /><br /> }, <br /> url: "/DataInput/Arrow_Load_Down?Id=" + Masterid + "&flag=" + "Right" + "&type=" + 0 + "&pgm_id=" + pgm_id, <br /> async: true, <br /> data: {},<br /> success: function (data) {<br /> $('#DVmaster').html(data);<br /> $('#btn_rightArw1').attr('hidden', false);<br /> $('#btn_LeftArw1').attr('hidden', false);<br /> var production_id = $('#program1').val();<br /><br /> $.ajax({<br /><br /> url: "/DataInput/Arrow_Load_Details_Down?Id=" + Masterid + "&flag=" + "Right" + "&ProductnSts_id=" + pgm_id + "&type=" + 0,<br /><br /> async: false,<br /> data: {},<br /> success: function (data) {<br /><br /> $('#DVDetails').html(data);<br /> $('#DVDetails').show();<br /> $('.fade_bg').hide();<br /> $('#btn_rightArw_Dwn').attr('hidden', false);<br /> $('#btn_LeftArw_dwn').attr('hidden', false);<br /><br /> },<br /> error: function (html) {<br /> $('.fade_bg').hide();<br /> }<br /> });<br /> <br /> var channelid = $("#channel1").val();<br /> var starttime = $("#StartTime").val();<br /> var Endtime = $("#EndTime").val();<br /> var date = $("#Date").val();<br /> var Vimpact = $("#Viewers").val();<br /> var gradeid = $("#grade1").val();<br /> var seclength = $("#Seconds option:selected").text();<br /> var Daypartid = $('#daypartid').val();<br /> var itemid = $('#item1 option:selected').val();<br /> var brandid = $("#brand1 option:selected").val();<br /><br /><br /><br /><br /> $.ajax({<br /> url: "/DataInput/Print_Labels_in_Edit?starttime=" + starttime + "&finishtime=" + Endtime + "&date=" + date + "&channelid="<br /> + channelid + "&impact1=" + Vimpact + "&Seclength=" + seclength + "&gradesid=" + gradeid + "&itemid=" + itemid + "&brandid=" + brandid,<br /><br /> cache: false,<br /> success: function (html) {<br /> var labels = html.split(',');<br /> var daypartname = labels[0];<br /> var CPH = labels[1];<br /> var TVR = labels[2];<br /> var Mediavalue = labels[3];<br /> var daypartid = labels[4];<br /> $('.fade_bg').hide();<br /> $('#lblDaypart').text(" " + daypartname);<br /> $("#lblCPH").text('£' + " " + CPH);<br /> $('#lblTvr').text(" " + TVR);<br /> $('#lblMediaValue').text(" " + "£ " + Mediavalue);<br /> $('#daypartid').val(daypartid);<br /><br /><br /><br /> },<br /> error: function (html) {<br /> $('.fade_bg').hide();<br /> }<br /> });<br /> <br /> }<br /><br /> });<br /> $('.fade_bg').hide();<br /> }<br /> });<br /><br />Kindly replay me.<br /><br />Advance thanks.