Understanding of Fetch, Axios, and Ajax

1. Basic concepts Fetch, Axios, and Ajax are all tools or technologies used by the front end to send HTTP requests: Fetch: A modern network request method that uses Promise to handle asynchronous operations, simply and intuitively sending HTTP requests and processing responses, and supports various functions and APIs, such as setting request headers, passing […]

*Ajax in VS Code

Download the plug-in and use it Download the plug-in and open a port for the resources to be loaded to solve cross-domain problems. There is no backend to receive data, so it is suitable for making small modules. Create a folder and put the jquery plug-in and json file under the folder data.json { “total”: […]

How to encapsulate Ajax requests, how to solve cross-domain problems, how to use core to solve cross-domain problems

Table of Contents 1.Ajax principle 2. Why encapsulation? 3. How to encapsulate 4.How to request 5. How to solve Ajax cross-domain problems 6. Use CORS to solve Ajax cross-domain issues 1. Server 2.Client 1.Ajax principle Ajax (Asynchronous JavaScript and XML) is a technology that exchanges small amounts of data with the server in the background […]

*Writing style of Ajax jq in Django 1

Import the plug-in, import jquery, json is the added json file Ajax get request and post request urls.py path(‘in3/’,views.in3), views.py def in3(request): return render(request,’07.html’) The path to return data is not written. The html is the content of the console in the picture below. Remember to pass the parameters. 07.html【get request】 {% load static %} […]

Python’s Flask framework receives ajax post type data and get type data from the front end.

ajax sends data to the background: ①post method ajax: <strong>@app.route(“/find_worldByName”,methods=[‘POST’])</strong> <strong>type:’post’,</strong> <strong>data:{‘cname’:cname,’continent’:continent},<br>This is the post method of passing value<br>Then receiving in the background is: (use the form method of request)<br></strong> <strong>continent = request.form.get(“continent”)</strong> <strong>cname = request.form.get(“cname”)</strong> ②get method (url parameter) Use the values method of request <strong>data:{‘cname’:cname,’continent’:continent},<br></strong> <strong>name=request.values.get(“cname”)<br><br><br>Summarize:<br></strong>The difference between the two is that the […]

5.Python-Use the XMLHttpRequest object to send Ajax requests

Inscription Use the XMLHttpRequest object to send Ajax requests. The following is a simple example and operation process. Install flask module pip install flask Install the mysql.connector module pip install mysql-connector-python Write app.py file The app.py file is as follows: from flask import Flask, request, render_template import mysql.connector app = Flask(__name__) # Connect to MySQL […]

Use ajax to write operations such as adding, deleting, modifying, etc. with paging

Table of Contents 1. Pojo layer code 2. Mapper configuration file code 3. Service layer code 4. Controller layer code 5. html code 6. list.css code 7. popup1.css code 1. Pojo layer code package com.example.ajax.pojo; import java.util.Date; /** * @Author song * @Date 2023/10/8 */ public class PatientInfo { private int bh; private String jzkh; […]

Http request response Ajax filter

10/10/2023 Recent summary: I have recently learned about back-end deployment, running web servers, and various request responses. There is a lot of content and it is very messy. I still need to sort it out. I have not fully mastered the previous JavaSE content. Plus, I feel a lot of pressure as I study questions […]