Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82280

How can I add ajax data into a checkbox?

$
0
0

Hi Alan, here's my javascript: ···editor1.on('preOpen', function (e) { e.preventDefault();

            $.ajax({
                url: '/api/boss/vipCredit',
                data: {id:table.row( '.selected' ).data().sc_channel_credits.channelId},

                success:function(data) {

                    console.log(data);
                    editor1.add({
                        label: "会员卡信息:",
                        name: "sc_org_vips[].name",
                        type: "checkbox",
                        options:data
                    });

                }
            });

        });

··· and here's the ajax data format: [{"id":1,"name":"vip1"}]

When I tried to launch it , there's some error occured. Would you please tell me how to insert the checkbox value by the option method or there's a correct method to add it?

One more question, due to the ajax delay, which event should I insert the ajax to add the checkbox before the editor opened?


Viewing all articles
Browse latest Browse all 82280

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>