Jquery Click event firing Multiple times/On change event happens more than twice
Below Ajax code executing more than once in a single change event.Here if i m trying to upload the file in the ajax call server side script is executing more than once
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$('.myfile').on('change',function(){ $.ajax({ url: siteUrl+'/getdata', async: true, type: "POST", data: formData, dataType: "json", success: function (data) { } }); }); |
Soultion: change the click action with bind option as below
1 2 3 4 |
use the below line $('.myfile').unbind().on('change',function(){ instead of $('.myfile').on('change',function(){ |