How can I get jQuery to perform a synchronous, rather than asynchronous, Ajax request?

From the jQuery documentation: you specify the asynchronous option to be false to get a synchronous Ajax request. Then your callback can set some data before your mother function proceeds.

Here”s what your code would look like if changed as suggested:

beforecreate: function (node, targetNode, type, to) {
        url: '' + + '?name=" + encode(to.inp[0].value),
        success: function (result) {
            if (result.isOk == false) alert(result.message);
        async: false

Leave a Comment