にポストからデータを返します:はどのように私はこのコードを持っている変数のjQuery
function nameToCode(nameGroup) {
$.post("execute.php", { something: sendSomething }, function(data) {
return data;
});
}
variable = nameToCode("some text");
しかし、私は変数に取得する唯一のものは、任意のアイデア定義されていませんか?ありがとう。
function nameToCode(nameGroup, callback) {
$.post("execute.php", { something: sendSomething }, function(data) {
callback(data);
});
}
nameToCode("some text", function(variable)
{
/* use variable here */
});