Return value of $.post() call

后端 未结 2 940
不知归路
不知归路 2021-01-24 07:49

I have a jquery $.post function lik so:

$.post(\'/test\',json_data, function(data) {
                                result=data
});

this fun

2条回答
  •  鱼传尺愫
    2021-01-24 08:04

    Check for validity inside the callback

     $.post('/test',json_data, function(data) {
        var result=data;
        if(result === true) {
            // do some ok processing...
            } else {
            // do not ok processing...
            }
    });
    

提交回复
热议问题