Created
December 20, 2015 14:58
-
-
Save tilsammans/8968cfcfaac936e985c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PostcodeCheck = React.createClass({ | |
// all existing code again omitted | |
handleSubmit: function(e) { | |
e.preventDefault(); | |
if (!this.state.postcode || !this.state.housenumber) { | |
this.setState({result: 'Postcode en huisnummer zijn verplichte velden.'}); | |
return; | |
} | |
$.ajax({ | |
dataType: 'json', | |
url: '/postcodecheck/' + this.state.postcode + '/' + this.state.housenumber + '/' + this.state.housenumberAddition, | |
success: function(data) { | |
if (data.available) { | |
this.setState({result: 'Uw adres is beschikbaar in BLITTS!'}); | |
} else { | |
this.setState({result: 'Uw adres is helaas nog niet beschikbaar in BLITTS voor het aanvragen van een vergunning, maar u kunt wel controleren of u vergunningsvrij kunt bouwen.'}); | |
} | |
}.bind(this), | |
error: function(xhr, status, err) { | |
console.error(status, err.toString()); | |
}.bind(this) | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment