Skip to content

Instantly share code, notes, and snippets.

@reginaldojunior
Last active June 9, 2017 16:30
Show Gist options
  • Save reginaldojunior/81e0e59de146605a301ca827c4f2124e to your computer and use it in GitHub Desktop.
Save reginaldojunior/81e0e59de146605a301ca827c4f2124e to your computer and use it in GitHub Desktop.
teste.php
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<input name="botao" id="btnSubmit" />
<script type="text/javascript">
$(document).ready(function(){
// pega o evento click do btn de id="btnSubmit"
$('#btnSubmit').click(function(){
$.ajax({
url: 'http://127.0.0.1/agrvai/save.php',
data: {},
method: 'POST',
dataType: 'JSON',
success: function(data) {
console.log(data);
//retorno dos dados da tratativa do php
}
});
});
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment