
Ajax POST request with JQuery và PHP, jQuery AJAX nội dung bài viết Example with PHP and JSON, How to lớn POST data khổng lồ php file using AJAX, how to lớn pass data khổng lồ α php file.
Bạn đang xem: ajax jquery php
Today we will explain to lớn you how to lớn make ajax POST request with JQuery và PHP. In this article we’ll simply create size in HTML và submit khung data via ajax POST request. Later on you can insert it into the database or use it in your further logic.
Bạn đang xem: Jquery ajax post method
jQuery AJAX nội dung bài viết Example with PHP and JSON, jQuery Ajax POST example with PHP, How to lớn POST data to lớn php file using AJAX, How vì Ι pass data khổng lồ α php tệp tin using jquery AJAX, jQuery Ajax nội dung bài viết with data, Php jquery ajax bài viết request example, Jquery Ajax bài viết Example For Submitting AJAX Forms in PHP, jQuery Ajax GET & POST Requests, Simple Ajax request example with JQuery và PHP, How khổng lồ Use AJAX in PHP and jQuery, ajax nội dung bài viết to php & get return data, send response from php khổng lồ ajax, how to lớn use ajax response in php, jquery ajax điện thoại tư vấn php function with parameters, ajax pass variable to lớn php, how khổng lồ get ajax value in php
What is AJAX và how it works
AJAX stands for Asynchronous JavaScript và XML, is α client-side script that allows trang web applications lớn work asynchronously without α page refresh. It fetches the data from the back-end server and updates the part of the trang web page without reloading the whole webpage.
Basic Ajax POST request
1
2
3
4
5
6
7
8
9
10
11
$
.
ajax
(
type
:
“POST”
,
url
:
‘script.php’
,
data
:
name
:
‘John’
,
success
:
function
(
data
)
console
.
log
(
data
)
;
,
error
:
function
(
xhr
,
status
,
error
)
console
.
error
(
xhr
)
;
)
;
Let’s try lớn understand the parameters in brief.
type – Type of http request like POST, GET, PUT, DELETE. In the above code snippets, we used POST.
Xem thêm: Cẩn Trọng Khi Tẩy Lông Đẹn Ở Trẻ Sơ Sinh, Chuyên Gia Cảnh Báo
url – The external URL that we want to send the ajax request. Here we used script.php.data – Data which we want lớn send in the request. We have passed name: ‘John’ in the above code.success – If the ajax request runs successfully then this function is called. In the above function we have α data parameter that is the đầu ra of the request url.error – If the ajax request failed then this function is called so we can debug the issue.Also, we can use α datatype parameter ι.e. Json that helps us lớn receive the data in expected format from the server.It’s time lớn create an example so Ι would like to divide this article in separate steps. In this example we’ll create an HTML khung that contains the fields such as name, thư năng lượng điện tử và message & handle ajax POST request on click of the submit button.
Steps to make Ajax POST request with JQuery và PHP
1. Create an HTML form
In the first step, we have lớn create an HTML size with the use of several fields like First Name, Last Name, Tin nhắn hộp thư online & Message. Also we’ll địa chỉ cửa hàng the button to lớn submit the khung data via ajax call.