-1

私はjqueryを使用して応答ボックス(ajax)を構築しています。

ajax呼び出しでリクエストを送信し、jsonの応答を待ち、応答を使用して情報ボックスを表示します。

返されたJSON:

$(document).ready(function(){
    // disable the form submit
    e.preventDefault();
    //Button click event
    $("#operation").click(function(e){
        //Disabling button
        $("#operation").attr('disabled', 'disabled');
        // get the input data
        var input = $("#nameImport").val();
        //Perform POST for triggering long running operation
        $.get('update', {
            name: input
        }, function(data){
            onSuccessImport(data);
        }, "json");
    });
});

ありがとう。

4

1 に答える 1

0

私が見る唯一の問題は、ハンドラーe.preventDefault()の中に入る必要があるということです..click

//Button click event
$("#operation").click(function(e){
    // disable the form submit
    e.preventDefault();

より一般的なコメントは、 (の代わりに.propDOMプロパティをいじるために使用する必要がある ため、使用することです.attr

$("#operation").prop('disabled', true);
于 2013-02-25T13:32:40.453 に答える