jquery - Update Modal Pop With Ajax Response And Display in Yii -
i have been trying render modal pop html data , display pop up. have used ajax data controller , want update modal , show it. data displayed correctly first time , modal shows doesnot show same modal next time. instead throws error:
object [object object] has no method 'modal'
below code:
link trigger ajax call:
<a data-toggle="modal" href="#" class="open-edituser btn default btn-xs green-stripe">edit</a>
modal pop up
<div id="edituser" class="modal fade" tabindex="-1" data-width="760"> <div class="modal-body"> <div id="modal-data"></div> </div> <div class="modal-footer"> <button type="button" data-dismiss="modal" class="btn btn-default"><?php echo yii::t('user', 'close'); ?></button> </div> </div>
response ajax call
$(document).on("click", ".open-edituser", function() { $.ajax({ type: "get", url: $(this).attr('href'), success: function(data) { $('#edituser').modal('show'); $('#modal-data').html(data); } }); return false; });
any idea regarding this. let me know.
cheers.
include in popup:
$cs = yii::app()->clientscript; if (yii::app()->request->isajaxrequest) { $cs->scriptmap['jquery.js'] = false; }
this make sure jquery isn't reloaded when open popup. without line jquery loaded again , lose previous set functions , methods, .modal()
Comments
Post a Comment