Now I can find solution:

$('#btn_print_preview').click(function(){
                if(validate()){
                    var invoice_no = $('#txt_invoice_code').val();

                    var note = $('#txt_note').val();
                    var result = false;
                    $.ajax({
                             type : "POST",
                             url  :
'/Billing_System/Invoices/check_session/',
                             data : {'invoice_code':invoice_no},
                             dataType: 'json',
                             async:false,   //NOTE THIS

                             success : function(data,event){

                                        if(data['result']==true){

                                            success = true




                                            }
                                        else{
                                            alert('Please total invoice
first')
                                            }

                             }
                    });
                    if(success == true){
                        window.open('preview','_blank')
                        }

                    }
            })

-- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.


Reply via email to