-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjavascript.js
47 lines (40 loc) · 1.02 KB
/
javascript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var SomeComponent = React.createClass({
render: function(){
return(
<h3>{this.props.header}</h3>
);
}
});
React.render( <SomeComponent header="Dette er en tittel :)"/>, document.getElementById('content'));
var EinarsComponent = React.createClass({
getInitialState: function(){
return {
post: ''
};
},
componentDidMount: function(){
var x = Math.floor((Math.random() * 9000) + 999);
var y = x.toString();
$.ajax({
url: "https://api.bring.com/shippingguide/api/postalCode.html",
data: {clientUrl: "localhost", pnr: y },
success: function(data){
var s = $(data).html();
this.setState({post: s});
}.bind(this)
});
},
render: function(){
return(
<li><input className="mdl-checkbox__input" type="checkbox"></input>{this.state.post}</li>
);
}
});
React.render(<ul>
<EinarsComponent />
<EinarsComponent />
<EinarsComponent />
<EinarsComponent />
<EinarsComponent />
</ul>
, document.getElementById('hei'));