Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nautics889/b828f51b2e282ffbc7ca23f3b0d77db0 to your computer and use it in GitHub Desktop.
Save nautics889/b828f51b2e282ffbc7ca23f3b0d77db0 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script
src="https://code.jquery.com/jquery-1.12.4.js"
integrity="sha256-Qw82+bXyGq6MydymqBxNPYTaUXXq7c8v3CwiYwLLNXU="
crossorigin="anonymous">
</script>
<script type="javascript">
function call() {
var msg = $('#form1').serialize();
$.ajax({
type: 'POST',
url: 'get.php'
data: msg,
success: function(data) {
$('#results').html(data);
},
error: function(xhr, str) {
alert('Возникла ошибка: ' + xhr.responseCode);
}
});
}
</script>
</head>
<body>
<h1>Result:</h1>
<form method="POST" action="javascript:void(null)" id="form1">
Name: <input type="text" id="name">
E-mail: <input type="text" id="mail">
<input type="submit" onclick="call()">
</form>
<div id="results">Вывод</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment