如何显示 Ajax 警报?

我有多个功能,其统一格式如下:

function xxx
    $.ajax({
        type: "POST", 
        url: "orders.php",
        data: {"error":"0","type": "inform","result4": $orderid},
        dataType: 'json', 
        success: function(data) {
        if (data.error != 0) {
            // An error occurred on server: do something 
        } else {
            Alert("Informed");
        }
    }
    });

    }

我调用的另一个PHP文件将返回以下内容:

echo json_encode(array("error"=>0, "result4"=>"Pass"));

1)我怎么让它显示Alert?它不想运行警报。

2)当它运行的时候,如何显示GIF加载?

Use alert not Alert

And you can use ajaxStart as part of jquery to display the loading .gif

$(document).ajaxStart(function() {
   $("#loading").show();
});

Where loading is the element with the loading.gif

I think its typo Alert=>alert

Also function should have () in function xxx

Return after encoding json in php