Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch 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('' + + '?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

Related Hot Questions

Government Jobs Opening