Jquery 通过Ajax更新数据表实体
在Symfony2中尝试更新视图中表中的元素时,我一直遇到此错误: 无法更新单元格服务器错误 我不确定是什么问题。路由是否不正确 包含javascript和表的twigview文件 用于从控制器检索表数据的javascript:Jquery 通过Ajax更新数据表实体,jquery,jquery-plugins,symfony,datagrid,datatables,Jquery,Jquery Plugins,Symfony,Datagrid,Datatables,在Symfony2中尝试更新视图中表中的元素时,我一直遇到此错误: 无法更新单元格服务器错误 我不确定是什么问题。路由是否不正确 包含javascript和表的twigview文件 用于从控制器检索表数据的javascript: <script language="JavaScript" type="text/javascript"> $(document).ready(function () { $('#myDataTable').dataTable(
<script language="JavaScript" type="text/javascript">
$(document).ready(function () {
$('#myDataTable').dataTable(
{
"bSort": true,
"bFilter": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "{{ path('CetiucValidateSurveyBundle_renderJson')}}"
}
).makeEditable({
sUpdateURL: "{{ path('CetiucValidateSurveyBundle_updateChange')}}"
}
);
});
</script>
这是更新操作的路由条目
CetiucValidateSurveyBundle_updateChange:
defaults: { _controller: "CetiucValidateSurveyBundle:Validate:updateChangeAction", _format: json }
pattern: /update
requirements: { _format: (json), _method: POST }
这是我调用update方法时编写的日志,我没有发现任何对我的问题有用的东西:
[2012-10-16 03:25:55]event.DEBUG:通知事件内核。请求
听众
Symfony\Bundle\FrameworkBundle\EventListener\RouterListener::onKernelRequest。
【】【2012-10-16 03:25:55】请求信息:匹配的路线
CetiucValidateSurveyBundle\U renderJson参数:控制器:
Cetiuc\Bundle\ValidateSurveyBundle\Controller\ValidateController::RendersonAction,
_路线:CetiucValidateSurveyBundle_renderJson[][]2012-10-16
03:25:55]event.DEBUG:通知了侦听器的事件kernel.request
Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest。
[]事件调试:通知的事件
kernel.controller到侦听器
Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector::onKernelController。
[]事件调试:通知的事件
kernel.controller到侦听器
Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController。
[]事件调试:通知的事件
kernel.controller到侦听器
Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController。
[]事件调试:通知的事件
kernel.controller到侦听器
Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController。
[]事件调试:通知的事件
kernel.controller到侦听器
JMS\SecurityExtraBundle\Controller\ControllerListener::OnReconController。
[]事件调试:通知的事件
内核对侦听器的响应
Symfony\Component\Security\Http\Firewall\ContextListener::onKernelResponse。
[]事件调试:通知的事件
内核对侦听器的响应
Symfony\Component\HttpKernel\EventListener\ResponseListener::onKernelResponse。
[]事件调试:通知的事件
内核对侦听器的响应
Symfony\Bundle\SecurityBundle\EventListener\ResponseListener::onKernelResponse。
[]事件调试:通知的事件
内核对侦听器的响应
Symfony\Bridge\Monolog\Handler\FireHPHandler::onKernelResponse。[]
[]事件.调试:通知的事件内核.响应
倾听者
Sensio\Bundle\FrameworkExtraBundle\EventListener\CacheListener::onKernelResponse。
[]事件调试:通知的事件
内核对侦听器的响应
Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelResponse。
[]事件调试:通知的事件
内核对侦听器的响应
Symfony\Bundle\WebProfilerBundle\EventListener\webdebugtoolblistener::onKernelResponse。
[][]
好的,谢谢卡洛斯。我做了一些研究,更新功能不需要任何json功能 由于您的错误是服务器错误,如果您能够提供symfony2日志,以便我们能够识别服务器端错误,那将是非常好的
您的更新方法或路由可能有问题。谢谢@artworkad。我按照您的建议使用json和路由进行响应,但我仍然有相同的单元格无法更新服务器错误可编辑插件不需要json。返回您收到的原始值Hanks Carlos。我的路由可能有问题,我将尝试查看是否在日志中找到了一些内容。我在上面发布的日志中没有找到任何有用的内容。请在调试模式下运行你的应用程序yourproject/app_dev.php/然后查看开发日志为什么一直使用bServerSide=true?这与你的问题无关,但这又不是你需要的
CetiucValidateSurveyBundle_updateChange:
defaults: { _controller: "CetiucValidateSurveyBundle:Validate:updateChangeAction", _format: json }
pattern: /update
requirements: { _format: (json), _method: POST }