-1
I wanted to know how I send form without refresh, I managed to put not to give refresh but I want to appear a screen soon after giving the "Email sent successfully".
-1
I wanted to know how I send form without refresh, I managed to put not to give refresh but I want to appear a screen soon after giving the "Email sent successfully".
0
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Documento sem título</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<script type="text/javascript">
$(document).ready(function () {
$('#forms').on('submit', function() {
$.ajax({
url: 'dados.php',
type: 'post',
data: $('#forms').serialize(),
success: function(data) {
$(".menu").show('fast');
$('#atuar').show('fast'); }
});
return false;
});
});
</script>
<style>
.menu{
position: relative;
float: left;
width: 300px;
background: #12C12B;
}
#atuar{
position: relative;
float: left;
clear: left;
margin-top: 5px;
background: red;
}
</style>
<body>
<div>
<form id="forms">
<input type="text" name="name" placeholder="digite o nome" />
<input type="submit" value="enviar" />
</form>
</div>
<div class="menu" hidden>enviado com sucesso!</div>
<div id="atuar" hidden ><input type="button" value="download"></div>
</body>
</html>
now the page that receives the data php data.
<?php
$dados = $_POST['name'];
?>
0
Try this way using jquery and ajax:
<p></p>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
</script>
<script>
$(document).ready(function () {
var json = '{"mensagem":[{' +
'"assunto":"' + tIdP + '",' +
'}]}';
$.ajax({
type: 'POST',
url: 'file.php',
data: {'json': json},
success: function (data) {
$('p').append('Mensagem enviada com sucesso!");
}
});
});
</script>
Browser other questions tagged php html jquery ajax
You are not signed in. Login or sign up in order to post.