【问题标题】:Can't make this work [closed]无法完成这项工作[关闭]
【发布时间】:2016-09-04 15:48:46
【问题描述】:

如何更改变量值?,我尝试使用“Promises”,但它不起作用,它给了我一个错误,我正在尝试在表上加载数据

                /* Formating function for row details */
                function fnFormatDetails(oTable, nTr) {
                    var aData = oTable.fnGetData(nTr);
                    var sOut ='';
                    $.post("http://localhost:3000/almuerzo/findIng", {
                            nombre: aData[1]},
                        function(data, status){
                            sOut = '<ul>';
                            sOut += data.nombre;
                            sOut += '</ul>';
                        });                    
                        return sOut;
                }

正如我所说,当我尝试使用 promises de “datable.tabletools plugin”失败时,说“show”有错误

【问题讨论】:

  • 你得到什么错误?

标签: javascript jquery datatables


【解决方案1】:

你不能用

return sOut;

在回调函数之外。

在您的示例中,sOut 始终为 ''。

【讨论】:

  • 知道我怎样才能完成这项工作吗?
  • 不要从您的回调中返回。只需从您的回调中对 sOut 做任何您需要做的事情。
猜你喜欢
  • 2015-03-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-01-13
  • 1970-01-01
  • 1970-01-01
  • 2023-03-28
  • 1970-01-01
相关资源
最近更新 更多