Web Front-end development-question about the interaction between the Web Front-end and the backend (PHP), except that post is AJAX?

Source: Internet
Author: User
Recently I want to create a website background management system. Then there is a button at the front end, which says "clear data ". Then, when you click the button, all the database data in the server and the files uploaded on the website are cleared (because many spam users are involved in the test ).... Recently I want to create a website background management system. Then there is a button at the front end, which says "clear data ". Then, when you click the button, all the database data in the server and the files uploaded on the website are cleared (because there are many junk users during the test ).
Backend operations are completed using PHP. The frontend interacts with php. I just make a POST, GET submission, and AJAX.
My approach is as follows:
My practice is like this. I got a form, and the button is the submission. The form contains a hidden field of input. Clicking it is actually a POST submission.
Another method is to click the button to start the onClick method and use AJAX to submit the onClick method.
What is the implementation of this situation?
There should be only one of these two methods, which is the same as clicking the next page on the previous page. Although it is only a button, you still need to pass the parameters to the server ..

Reply content:

Recently I want to create a website background management system. Then there is a button at the front end, which says "clear data ". Then, when you click the button, all the database data in the server and the files uploaded on the website are cleared (because there are many junk users during the test ).
Backend operations are completed using PHP. The frontend interacts with php. I just make a POST, GET submission, and AJAX.
My approach is as follows:
My practice is like this. I got a form, and the button is the submission. The form contains a hidden field of input. Clicking it is actually a POST submission.
Another method is to click the button to start the onClick method and use AJAX to submit the onClick method.
What is the implementation of this situation?
There should be only one of these two methods, which is the same as clicking the next page on the previous page. Although it is only a button, you still need to pass the parameters to the server ..

I think the subject may not understand POST and GET. The subject must be Ajax. No matter whether it is post or get, the page will jump back, the page also needs to be refreshed, which is a waste of time.

Use AJAX to wear a parameter and judge whether to clear the parameter.

The simplest is ajax, and post is troublesome.

You don't need to add a form. Since Ajax submits parameters, You can unload Ajax data. serialize serializes the data or directly $ ('xxx'). val () gets the hidden data. Click the button to punish Ajax events.

Traditional POST and GET operations are acceptable.
The AJAX experience is better. send a request to the backend and then delete the dom on the page.

ASIDE: A term used to be called "graceful degradation. That is, when you cannot use scripts for various reasons on the page, you can use form to downgrade the page.

Now we basically use ajax to call back and forth.
You can use post get.
Get can be used only for parameters.
If encryption information is involved, post can be used for data over-length slice information.

You can see $. ajax {} In jquery {}.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.