Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


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


I have a JavaScript widget which provides standard extension points. One of them is the beforecreate function. It should return false to prevent an item from being created.

I've added an AJAX call into this function using jQuery:

beforecreate: function (node, targetNode, type, to) {
  jQuery.get('http://example.com/catalog/create/' + targetNode.id + '?name=' + encode(to.inp[0].value),

  function (result) {
    if (result.isOk == false) alert(result.message);
  });
}

But I want to prevent my widget from creating the item, so I should return false in the mother-function, not in the callback. Is there any way to perform a synchronized AJAX request using jQuery or any other API? Thanks


asked Apr 24, 2015 in jquery by rajesh
0 votes
58 views



Related Hot Questions



Walkin Jobs Opening



Government Jobs Opening


...