Abhilash J A

Abhilash J A

  • 533
  • 2.4k
  • 597.9k

Button click ajax call firing multiple times in mvc4?

Jul 18 2016 7:02 AM
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 + "&amp;flag=" + "Right" + "&amp;type=" + 0 + "&amp;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 + "&amp;flag=" + "Right" + "&amp;ProductnSts_id=" + pgm_id + "&amp;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 + "&amp;finishtime=" + Endtime + "&amp;date=" + date + "&amp;channelid="<br /> + channelid + "&amp;impact1=" + Vimpact + "&amp;Seclength=" + seclength + "&amp;gradesid=" + gradeid + "&amp;itemid=" + itemid + "&amp;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('&#163;' + " " + CPH);<br /> $('#lblTvr').text(" " + TVR);<br /> $('#lblMediaValue').text(" " + "&#163; " + 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.

Answers (1)