> For the complete documentation index, see [llms.txt](https://javascriptuse.gitbook.io/javascript/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://javascriptuse.gitbook.io/javascript/advanced/submit-form-submit-jquery-ok.md).

# \[SUBMIT ] form submit jquery (ok)

![](/files/-MMUH-4zmKYQUI85vUoQ)

```
<!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>
```

![](/files/-MMUH80-RwgKwXdmL6Kz)

> 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>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://javascriptuse.gitbook.io/javascript/advanced/submit-form-submit-jquery-ok.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
