Skip to content

Instantly share code, notes, and snippets.

@atcasanova
Created May 30, 2014 19:51
Show Gist options
  • Save atcasanova/0904b4ef323055ddb075 to your computer and use it in GitHub Desktop.
Save atcasanova/0904b4ef323055ddb075 to your computer and use it in GitHub Desktop.
<script >
$(function(){
$("form.form_ajax").on('submit',function(event){
event.preventDefault();
console.log('submit');
var
$this = $(this),
$dialog = null,
titulo = $this.data('title')
;
console.log(titulo);
$dialog = $('#dialog');
$dialog.dialog({
autoOpen: false,
title: titulo,
modal: false,
width: '700',
height: '500',
close: function( event, ui ) {
//$dialogCadastrar.empty();
},
open: function( event, ui ) {
console.log('open');
},
buttons: {
'Fechar': function(){
$(this).dialog('close');
}//,
//'Enviar': function(){
// console.log('enviar');
//}
}
});
$('#carregando').show();
$.ajax({
url: $this.attr('action'),
dataType: 'html',
type: 'POST',
data: $this.serialize(),
//processData:false,
success: function(data) {
$dialog.html(data).dialog('open');
$('#carregando').hide();
},
error: function () {
}
});
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment