-
Notifications
You must be signed in to change notification settings - Fork 354
Closed
Labels
Description
I am newbie in react + node js developing. For start learning this technologies I decided to use react-webpack-generator and I like it for simplicity. But I have a question. Can I send ajax query from react component to node.js handler? In browser I always get 404 error, but I dunno why, because my handler located in the same directory as my component.
Example of code :
setAjaxQuery(){
$.ajax({
type: 'POST',
url: './fileHandler.js',
success: function(){
console.log('Success!')
}.bind(this),
error: function(){
console.log('Error!')
}.bind(this)
});
}
render() {
return (
<div className="test-component">
<button onClick={this.setAjaxQuery} value = "test"
className="test-btn"ref="test">Test</button>
</div>
);
}
Result in browser:
