## React
~~~
~~~
~~~
class Clock extends React.Component{
constructor(props){
super(props);
this.state = {
msg:"hello world",
img:"",
title:""
};
}
~~~
~~~
render(){
return (
)
}
~~~
~~~
componentDidMount(){
var url = "https://douban.uieee.com/v2/movie/top250";
$.ajax({
url,
type:"get",
dataType:"jsonp",
success: res=> {
var subjects = res.subjects[0];
var img = subjects.images.small;
var title = subjects.title;
this.setState(()=>{
return {
img,
title
}
})
}
})
}
}
~~~
~~~
ReactDOM.render(
,
document.getElementById('example')
);
~~~