Hi,
Based on the result of $.post(..) I wanna see if I have to return false. But the outer function finishes first and result from $.post(..) comes later.
How do I avoid that.
Code:$('.editable').inlineEdit({ save: function( event, hash ) { $("#message").html(ajax_load); var loadUrl = "parts/document_add_remove.php"; var truefalse = "true"; var message = ""; $.post( loadUrl, {type: "update", id: this.id, val: hash.value}, function(responseText){ if (responseText.indexOf('exists') > -1) { $person.focus(); $("#message").html(""); message = "Value already exists!"; truefalse = "false"; } else if (responseText.indexOf('invalid') > -1) { alert("Invalid value!"); $("#message").html(""); } else { $("#message").html(""); } }, "html" ); alert(truefalse); // always shows 'true', the 'false' value comes later from $.post() if (truefalse == "false") { return false; } } });


Reply With Quote
Bookmarks