hi,
how can i call growl using jquery
<?php
$success = Yii::$app->session->get('success');
if( isset ($success) )
{
echo Growl::widget([
'type' => Growl::TYPE_DANGER,
'title' => 'Error!',
'icon' => 'glyphicon glyphicon-remove-sign',
'body' => 'We have Encountered an Error',
'showSeparator' => true,
// 'delay' => 2500,
'pluginOptions' => [
// 'showProgressbar' => true,
'placement' => [
'from' => 'top',
'align' => 'right',
]
]
]);
Yii::$app->session->remove('success');
}
?>
this above is my code for alert in my view page. Its display is based on the value inside a session variable success. It is set inside the controller action. I want to display using jquery
<?php
$this->registerJs(
'jQuery(document).ready(function($){
$(document).ready(function () {
$("body").on("beforeSubmit", "form#dynamic-form222", function () {
var form = $(this);
// return false if form still have some validation errors
if (form.find(".has-error").length)
{
return false;
}
// submit form
$.ajax({
url : form.attr("action"),
type : "post",
data : form.serialize(),
success: function (response)
{
$("#ajaxModal").modal("toggle");
$.pjax.reload({container:"#countries"}); //for pjax update[size=2] [/size]
},
error : function ()
{
console.log("internal server error");
}
});
return false;
});
});
});'
);
?>