javascript - Ajax call does not assign a value in the done promise -
this question has answer here: how return response asynchronous call? 21 answers i have method this: var isnameunique = false; function validatename() { var url = "/somerules/checkifnameexists/"; var request = $.ajax({ url: url, method: "get", data: { sname: name}, datatype: "json" }); request.done(function (result) { if (result.doesnameexists) { alert("name exists!"); console.log("name exists!"); } else { isnameunique = true; console.log("name unique!"); } }); request.fail(function (jqxhr, textstatus) { console.log(textstatus); alert("request failed."); }...