Created
May 30, 2014 19:51
-
-
Save atcasanova/0904b4ef323055ddb075 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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