jQuery AJAX Success

后端 未结 6 1446
独厮守ぢ
独厮守ぢ 2021-01-17 10:08

I\'m using jQuery\'s $.ajax function to submit a form, which works, but the success is where I\'m having my problem. Here is my code:

$(\"#form\         


        
6条回答
  •  旧巷少年郎
    2021-01-17 10:39

    How to find the answer yourself:

    Place a debug code to see what you get from the server.

    $("#form").submit(function () {
            $.ajax({
                type: "POST",
                url: '/login/spam',
                data: formData,
                success: function (dataCheck) {
                    console.log(dataCheck); // <==============================
                    if (dataCheck == 'value') {
                         //Do stuff
                    }
                }
            });
            return false;
        });
    

    It will probably be in other format than you think.

提交回复
热议问题