duanfang5849 2017-08-23 08:40
浏览 55


I have a modal with some datas in a table and a radio button beside each row. Everytime I click that radio button, the corresponding datas will be stored in an array after clicking a button. Now, I have a problem in passing a variable from the javascript to my controller which is the 6th index of my array.

Based on what I have researched, most of the solutions were using ajax. I have already tried all the possible codes that I can in my controller but seems like it's not receiving anything. The data I sent in my ajax call did not reach the controller. Here is my twig file:

<button type="button" id="selectrow" class="btn btn-primary pull-right btn-spacing">Select</button>
$(document).ready(function () {
        $('#selectrow').click(function () {
          var data = selected[6];

                    url: "project/edit/",
                    type: "GET",
                    data: { "data": data },
                    success: function (data) {
                    error: function (data) {

The selected variable is where I stored the selected data somewhere in the file respectively. And below is my controller, I tried to display the following but the outputs are all null.

public function editAction(Request $request) {
       if ($request->isXmlHttpRequest()) {


I am just really confused because after clicking the button it alerts 'OK' however, the data is not being sent to the controller. Can someone help me with this? It will really be appreciated, thank you.

This is the output that I get:


  • 写回答

1条回答 默认 最新


      相关推荐 更多相似问题


      • ¥30 VB6.0操作 webview2内核的浏览器如何精确实现网页弹窗处置
      • ¥15 pr导出的视频打不开,提示“缺少编解码器”怎么解决
      • ¥15 html里js获取php参数值不成功,帮改代码
      • ¥20 如何控制ant design的InputNumber组件 最多输入5位小数
      • ¥15 c语言学生基本信息管理系统
      • ¥100 火车头采集器采集求解
      • ¥88 关于#运行时间 时间重叠 和非重叠#的问题,如何解决?
      • ¥15 C语言,密切接触者追踪
      • ¥20 关于计算机网络问题,请附带讲解
      • ¥30 自动识别图像目标并判断