我有這個函數,它從數據庫加載一個選擇。將函數結果保存到變量中
function Competition() {
$(document).ready(function() {
$.ajax({
url: "load-comp.php",
cache: false,
success : function(html) {
// something here
}
});
EditRow();
});
}
我需要把該選擇內confirmEdit(在第二個TD)。
EditRow() {
var confirmEdit = '<tr class="editable" id=" '+ id +' ">
<td><input type="text" value="' + name + '" /></td>
<td> ' + /* function result goes here */ + ' </td>
<td><input type="text" value="' + data + '" /></td>
<td>' + saveCancel + '</td>
</tr>';
}
那麼如何將由Competition()函數產生的結果保存在變量中,以便我可以在EditRow()函數中使用它?
如果我正確認識你,爲什麼你不只是從成功裏調用EditRow() ajax調用的一部分並通過html? – Ryan 2009-12-09 19:42:51