0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ajaxで非同期パラメータ送信

Posted at

#非同期でパラメータを送信(get)

$.ajax({
	url:"/tasks/delete/"+ deleteId,
	type:'GET',
})

//成功時の処理(resultに結果が入る)
.done( (result) => {
	//true(削除エラー)ならモーダルを出力
	if(result){
		$(".errorreveal,.errorlayer").show();
		//false(削除できた)
	}else{
	//画面をリロード
		location.reload();
	}

	//モーダルの「はい」をクリック時、モーダルを閉じる
	$(".close-errorbutton").on("click", function() {
		$('.errorreveal,.errorlayer').hide();
	});
})

//ajaxが失敗した場合の処理
.fail( (error) => {
	console.log("false");
})
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?