Cuando un usuario hace clic en un campo de fecha e ingresa una fecha, se envía una solicitud de publicación. Pero luego, cuando el usuario hace clic en algún lugar fuera del campo, la solicitud se envía por segunda vez. ¿Cómo corrijo esto? focusout() pero el problema persiste.
$(".cInput").focusout(function(){ var fieldName = this.name; var fieldValue = this.value; var cid = $('meta[name="cid"]').attr('content'); var cnum = $('meta[name="cnum"]').attr('content'); $.ajax({ /* the route pointing to the post function */ url: '/cUpdate', type: 'POST', /* send the csrf-token and the input to the controller */ data: {_token: CSRF_TOKEN, moduleID: $("#moduleID").text(), checkName: fieldName, checkValue: fieldValue, cid: cid, cnum: cnum}, dataType: 'JSON', /* remind that 'data' is the response of the AjaxController */ success: function (data) { window.history.replaceState({}, document.title, thisURL); } }); });