文書の過去の版を表示しています。
context に this を指定する。
<script>
$(function(){
$('#sendForm').on('click', function(){
var formData = new FormData($('#formName').get(0));
$.ajax({
url: 'hogehoge.php',
type: 'POST',
data: formData,
context: this,
processData: false,
contentType: false,
})
.then(
function (result) {
var re = JSON.parse(result);
$(this).data('fuga', re.fuga);
},
function(error) {
alert('システムエラーが発生しました。');
console.log(error);
}
);
});
});
</script>
コメント