Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
- <script>
- function send_data() {
- let name = 'Ваня';
- let age = 35;
- let location = 'Москва';
- $.ajax({
- url: 'test.php',
- type: 'POST',
- dataType: 'json',
- data: {
- func: 'func_data',
- name: name,
- age: age,
- location: location,
- },
- success: function(data){
- alert('Я '+data.name+', мне ' +data.age + ' лет. Мой город: ' +data.location);
- }, error: function(){
- alert('ERROR');
- }
- });
- }
- </script>
- <head>
- <meta charset="UTF-8">
- <input class="button" type="button" name="registration" value="Регистрация" onclick="send_data();">
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement