0

I have following code snipts :

            $.ajax({
            type:"GET",
            url: "/get-users-in-group/" + group_name,
            success: function(listUserInfo){
                $("#iti-mainContentScroll").empty()
                $("#group_header").text(group_name)
                for(var i = 0 ; i < listUserInfo.length ; i++ ){ 
                    var htmlStr = ""
                    htmlStr += '<div class="row" style="margin-left: 0px; margin-right:0px; padding-top: 2px; padding-bottom: 2px; border-top: 1px solid #BDC3C7;">'
                    htmlStr += '<div class="col-md-1">' + listUserInfo[i].local.username+ '</div>'
                    htmlStr += '<div class="col-md-2"><span style="padding-left:2px;">' + listUserInfo[i].local.email + '</span></div>' 
                        if(listUserInfo[i].local.active == true) {
                            htmlStr += '<div class="col-md-1"><input type="checkbox" user-name="'+listUserInfo[i].local.username+'" checked data-toggle="switch" id="custom-switch-01" onchange="activeUser(this)"  /></div>'
                        }else {
                            htmlStr += '<div class="col-md-1"><input type="checkbox" user-name="'+listUserInfo[i].local.username+'" data-toggle="switch" id="custom-switch-01" onchange="activeUser(this)"  /></div>'
                        }
                        htmlStr += '<div class="col-md-2"><span style="padding-left:5px;">' + listUserInfo[i].local.fullname + '</span></div>'
                        htmlStr += '<div class="col-md-2"><span style="padding-left:5px;">' + listUserInfo[i].local.reg_date + '</span></div>'
                        htmlStr += '<div class="col-md-2"><span style="padding-left:5px;">' + listUserInfo[i].local.reg_date + '</span></div>'
                        htmlStr += '<div class="col-md-2"><span style="padding-left:5px;"> '
                        htmlStr += '<a class="edit_user_btn"><span class="fui-new" >Edit</span></a>&nbsp;&nbsp;&nbsp;<a><span class="fui-trash" data-toggle="modal" data-target="#cf_delete_user_modal" class="delete_user" onclick=setUserDelete(this)>Delete</span></a>'
                        htmlStr += '</div>'
                    htmlStr += '</div>'
                    console.log(htmlStr)
                    $("#iti-mainContentScroll").append(htmlStr)
                    //$(htmlStr).appendTo('#iti-mainContentScroll')                         
                }
                   // Switches
                if ($('[data-toggle="switch"]').length) {
                  $('[data-toggle="switch"]').bootstrapSwitch();
                }
            }
        })

I testing on IE 11-Windows 8.1,function append() only work when Development tools opened for debugging ,when I closed Development tools,it not work ,htmlStr can not be appended to iti-mainContentScroll On Chrome ,firefox ,it work fine ! How can I solved it ?

Ryo
  • 995
  • 2
  • 25
  • 41
  • 1
    The `console` object is only available in IE when the development tools are open – Andreas Jul 16 '15 at 08:43
  • does `console` impact to `append()` function ?I remove `console.log(htmlStr)` but it still not work – Ryo Jul 16 '15 at 08:47
  • _does console impact to append() function ?_ Yes, at it will throw an error and stop the execution of the script at that position if the `console` object isn't available. Please define _not work_ – Andreas Jul 16 '15 at 08:52
  • Thanks ,I remove all console.log in script and it work – Ryo Jul 16 '15 at 09:06

0 Answers0