jQuery: Performing synchronous AJAX requests

后端 未结 4 2154
刺人心
刺人心 2020-11-22 04:48

I\'ve done some jQuery in the past, but I am completely stuck on this. I know about the pros and cons of using synchronous ajax calls, but here it will be required.

<
4条回答
  •  孤街浪徒
    2020-11-22 05:31

    function getRemote() {
        return $.ajax({
            type: "GET",
            url: remote_url,
            async: false,
            success: function (result) {
                /* if result is a JSon object */
                if (result.valid)
                    return true;
                else
                    return false;
            }
        });
    }
    

提交回复
热议问题