Confirmation Dialog After Save The Data

Hi,

I have no idea about it, please help me to do this task well.

Just i want to save the data in to table, after i saved the data, i need to show the dialog to user, to get the confirmation to print the data, whether its may be, yes or no, then i will redirect it appropriate url to print or end.

Please help me

Thanks

Dharma

You should provide more details to get a clear solution! Anyway I suppose you’re using ajax to save this data, so you just need to put some javascript code into your view to do the magic:


<?php

Yii::app()->getClientScript('saveAndRedirect', '

   jQuery(function(){

      $("#xyz").on("submit", "function(event){

         event.preventDefault();

         $.ajax({

            type: "POST",

            data: $(this).serialize(),

            url: "example.com/save",

            success: function(){

               if(confirm("print?"))

                  window.location="example.com/print"

               else

                  window.location="example.com/end"

            },

            error: function(){

               alert("sth went wrong!");

            }

         });

      }");

   })

', CClientScript::POS_END);

?>


<form id="xyz">

   <!-- your input fields -->

</form>