# \[SUBMIT ] form submit jquery (ok)

![](https://2726517656-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1E4Gk2ppVKb4olmnun%2F-MMUGiua888vMwmW5qmV%2F-MMUH-4zmKYQUI85vUoQ%2FScreenshot_1.png?alt=media\&token=ec0015b1-8075-469b-a88e-b51cae2050e7)

```
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("form").submit(function(){
    alert("Submitted");
  });
});
</script>
</head>
<body>
<form>
  First name: <input type="text" name="firstName" value="Mickey"><br>
  Last name: <input type="text" name="lastName" value="Mouse"><br>
  <input type="submit" value="Submit">
</form> 
</body>
</html>
```

![](https://2726517656-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1E4Gk2ppVKb4olmnun%2F-MMUGiua888vMwmW5qmV%2F-MMUH80-RwgKwXdmL6Kz%2FScreenshot_2.png?alt=media\&token=1f159ec5-aaf8-43f9-9c85-c6745d0274e8)

> Chú ý: Nếu ta sử dụng method="post" trên form thì đường đã này sẽ không có tham số :)&#x20;

```
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("form").submit(function(){
    alert("Submitted");
  });
});
</script>
</head>
<body>
<form method="post">
  First name: <input type="text" name="firstName" value="Mickey"><br>
  Last name: <input type="text" name="lastName" value="Mouse"><br>
  <input type="submit" value="Submit">
</form> 
</body>
</html>
```
