私はこのシンプルなonclickを仕事にしようとしています...しかし、私のfile.jsでは80%が動作し、この1つは(例えば)しません! onClick jQuery関数はトリガーしません
誰かが私を助けることができる場合
...機能:
jQuery(document).on("click", '#avatarGO', function(event){
toastr.clear();
jQuery('#avatarGO').addClass('disabled');
jQuery('.has-error').removeClass('has-error');
var formData = $("#changeAvatarForm").serialize();
jQuery.ajax({
type : 'POST',
url : '../../class/profile/change_avatar.php',
data : formData,
dataType : 'json'
})
.done(function(data) {
console.log(data);
if (!data.success){
//Failure
jQuery.each(data.sysemp, function(index, value){
jQuery('#'+value+'').addClass('has-error');
});
//Failure
jQuery.each(data.syserr, function(index, value){
toastr["error"](value);
});
jQuery('#avatarGO').removeClass('disabled');
} else {
//Success
toastr["success"](data.message);
setTimeout(function() { window.location.reload(); }, 850);
}
});
event.preventDefault();
});
HTML:
<button id="avatarGO" type="button" class="btn btn-block btn-success">Confirmar</button>
全ファイル:https://www.ertheya.com/assets/plugins/kCore.js
更新:
コンソールのエラーを示す フォームのonClickイマイチイマイチはHTMLが
何が動作しないか、エラーを貼り付けたり、予期しない動作を説明したりしてください。 – Creos
コンソールにエラーは表示されません。 –
それをあなたの質問に追加してください - あなたの質問にあなたが提供するより明確な情報、それは答えられるべきであり、下降していない可能性があります – Creos