Is there a way to align dynamic cards horizontally using ajax?

Mana Leech :

I am trying to make my cards horizontally, but the problem is I have an ajax that fetch my data and it is dynamic

I just need two cards every row in my page

Here is my ajax script code

for(i=0; i<data.length; i++){
    html +='<div class="col-md-6">'+
        '<div class="card" style="width: 15rem; text-align:center;display:inline-block;">'+
            '<div class="card-body">'+
                '<h5 class="card-title">'+data[i].group_name+'</h5>'+
                        '<h6 class="card-subtitle mb-2 text-muted">Modify your Group</h6>'+
                            '<a href="javascript:;" class="btn btn-info item-edit" data="'+data[i].id+'"><span class="iconify" data-icon="feather:edit" data-inline="false"></span></a>&nbsp;'+
                            '<a href="javascript:;" class="btn btn-primary item-delete" data="'+data[i].id+'"><span class="iconify" data-icon="dashicons:remove" data-inline="false"></span></a>'+
            '</div>'+
     '</div>'+
    '</div><hr>';
    }
$('#showdata').html(html);

and in the html

 <div class="container">
        <div class="row">

            <div id="showdata"></div>

        </div>
    </div>
haron68 :

I think what you have is mostly fine. Instead of updating html of a separate <div id='showdata'> combine it with your row.

 <div class="container">
    <div id='showdata' class="row"></div>
 </div>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=346457&siteId=1