I am a front-end person, and I am new to this aspect of data interaction. I know that I can parse json data, write php to receive background data, and then dynamically generate pages. This is all I know. I also want to know more about data interaction.
Please ask the masters to come and give me advice, express your opinions and introduce specific details!!
Beg on your knees!!! Beg on your knees!!! Beg on your knees!!!
The front-end and back-end data interaction relies on HTTP (or other derived types, such as SSE, WS, etc.)
What methods are available on the front end to initiate HTTP requests?
Orthodox Network API
XMLHttpRequest
Orthodox XHR request, with same-origin restriction
EventSource
It is SSE (server push) technology, evolved from HTTP
WebSocket
Bi-directional long connection communication between client and server
navigator.sendBeacon
The new asynchronous data reporting API is specially used for data collection. The browser will only perform data reporting at the appropriate time.
A typical scenario is to collect and report outbound behavior in a non-blocking manner.
Some black magic
<img>
In the past, when we did data collection and reporting, such as PV collection, we often used the img tag to construct a harmless HTTP GET request and pass the data to the backend through querystring.
For example, the commonly used GA should now be used instead
sendBeacon
, but img should be retained as a low version compatibility solution<script>
The famous JSONP uses the script tag to obtain data from the backend across domains
More
Let’s think about it. Can we use
<link>
、<iframe>
to interact with data?This should help you
http://www.cnblogs.com/cxying...
Three modes of front-end and back-end division of labor:
http://www.algorithmdog.com/%...