const LOGIN_URL = "https://tankernn.eu/login/check_login.php"; var LoginForm = React.createClass({ getInitialState: function() { return {user: '', pass: ''}; }, handleUserChange: function(e) { this.setState({user: e.target.value}); }, handlePassChange: function(e) { this.setState({pass: e.target.value}); }, handleSubmit: function(e) { e.preventDefault(); var user = this.state.user; var pass = this.state.pass; if (!user || !pass) { return; } this.props.onLoginSubmit({user: user, pass: pass}); this.setState(this.getInitialState()); }, render: function() { return (
); } }); var handleLoginSubmit = function(data) { $.ajax({ url: LOGIN_URL, cache: false, type: 'POST', data: data, success: function(result) { console.log(result); this.forceUpdate(); }.bind(this) }); }