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.

FormDataを使いjQueryでAjax送信

Posted at

前書き

初めてjQueryを用いてajax送信をしたので、忘れないようにメモ書き

コード

var hoge = "hoge";
fData = new FormData();
        fData.append('hoge', hoge);
        $.ajax({
            url: "hoge.php",
            type: 'POST',
            data: fData ,
            contentType: false,
            processData: false,
            success: function(data) {
              alert(data);
            },
            error: function(){
              alert("error");
            }

あとがき

contentType: falseprocessData: falseの指定を忘れないように注意
コードを書き終わってから気がついたが、書き方が古いようなので$ajaxの使い方をもう少し勉強する必要がありそう

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?