i want use bootstrap toggle button in ajax after success. there way. tried best implement not able completely.
<script> $(document).ready(function(){ $(".btn-primary").click(function(){ $(".collapse").collapse('toggle'); }); }); </script> <script type="text/javascript"> $('.other_chart').live("click",function(){ //e.preventdefault(); var userid2= $(this).attr("id").split('_').pop(); $.ajax({ type: "post", async: false, url: "index.php", data: "userid="+ userid2, cache: false, //beforesend: function(){$(".podar").show();}, success: function(html) { //$("#loader_"+userid1).hide(); $("#wholeinf1_"+userid2).toggle(); $("#wholeinf_"+userid2).empty().append(html); } }); }); </script> <div id="wholeinf1_<?php echo $res['userid']; ?>" style="height:auto; width:auto; display:none;"> <div id="wholeinf_<?php echo $res['userid']; ?>" style="height:auto; width:auto;"> </div> </div> <div style="display:block;"> <button class="other_chart" id="chart_<?php echo $res['userid']; ?>" type="button" class="btn btn-primary">view chart</button> </div>
you need add datatype: 'html'
$ajax
request.
and change $("#wholeinf1_"+userid2).toggle();
$("#wholeinf1_"+userid2).show();
Comments
Post a Comment