Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. startPhaseZero(blocDemoThreshold, blocVotingThreshold) {
  2. var blocJSON = {blocDemographicThreshold: blocDemoThreshold, blocVotingThreshold: blocVotingThreshold}
  3. let xhr = new XMLHttpRequest();
  4. xhr.open('POST', './MyServlet?action=startPhaseZero');
  5. xhr.setRequestHeader('Content-Type', 'application/json');
  6. xhr.responseType = 'json';
  7. xhr.onload = function() {
  8. if (xhr.status !== 200) {
  9. console.error("Error starting phaseZero");
  10. } else {
  11. // parse the JSON
  12. this.setState({divVisible: true})
  13. }
  14. }
  15. xhr.send(JSON.stringify(blocJSON));
  16. }
  17. render() {
  18. return <div>
  19. <PhaseZeroComponent></PhaseZeroComponent>
  20. Bloc Demographic Threshold<br></br>
  21. <input type="range" min="1" max="100" value={this.state.slider1} onChange={this.changeValue} step="1" class="slider" id="1"></input>{this.state.slider1}<br></br>
  22. Bloc Voting Threshold<br></br>
  23. <input type="range" min="1" max="100" value={this.state.slider2} onChange={this.changeValue} class="slider" id="2"></input>{this.state.slider2}<br></br>
  24. <button type="button" class = "btn btn-success" onclick = {this.startPhaseZero(this.state.slider1, this.state.slider2)}>Start PhaseZero</button><br></br>
  25. Slider 3<br></br>
  26. <div style = {visibility : divVisible ? block : hidden}> table </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement