ajax submission

//var an amount to receive the amount value of jsp

var amount = $("#amount").val();
            //The value of var is passed to data:{amount:amount, rowId:rowId},
            var rowId = $("#rowId").val();
            $ .ajax({
                type: "post",
                cache: false,
                url: "${ctx}/account/amountTest",
                //ajax submission must encapsulate the foreground data through data and submit it to the background
                data:{amount:amount, rowId :rowId},
                //The type of the return value is json
                dataType:"json",
                async:false,
                success: function(data) {
                    //alert(data);
                    //debugger;
                    if (data==1) { 
                        $("#outAccountTable").submit();
                    }else {
                        layer.msg("The transfer amount cannot be greater than the account balance", {icon:0});
                        return;
                    }
                }

 

async:true, (default), asynchronous mode, after $.Ajax is executed, the script behind ajax will continue to be executed, until the server returns data, the success method in $.Ajax is triggered, and two threads are executed at this time.

async:false, synchronous mode, all requests are synchronous requests. Before there is no return value, the synchronous request will lock the browser, and the user must wait for the request to complete before executing other operations.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325896667&siteId=291194637