CodePudding user response:
If you did not use vue, react, presents such as framework, then directly on the success callback to get the data, take out your want to data, in the place where the
Such as: HTML inside & lt; Div & gt; & lt; div> Name: & lt; Span> & lt;/span> & lt;/div> & lt;/div>
So success callback to name
Var HTML=` & lt; div> Name: & lt; Span> The ${res. Data. The name} & lt;/span> & lt;/div> `
To get the results of $(' box '). The HTML (HTML) without jquery document. GetElementsByClass (' box ') [0]. InnerHTML ()
This is probably
CodePudding user response:
(1) the first data () {Return {
Items: "',//define a stored data variables;
}
}
(2) in the place where you put the data to print to the console that is: the console. The log (res) data); There
Enter this. The items=res. Data;
(3) rendering using v - for start loop v - if control cycles
Example: & lt; Div v - for='(item, index) in the items' v - if=' index & lt; 5 '& gt;//the item is in the definition of a variable, the index page, mean circulation first 5 data shown here
& lt; div> . {{item name}} & lt;/div> Here the name only, for example, you want to see give you specific what packets,
& lt;/div>
OK, now you want to data has been rendered to the page,
I am also just learn to use axios and rendered to the page is not enough in-depth study bosses forgive me just to share personal experience