Allows to resize a file input image before upload to the server. The resized image will be attached to original file input. Then you can submit your form without ajax or handle it as you need.
<form>
<label>Select image</label>| fetch(ajax_url, { | |
| method: 'POST', | |
| credentials: 'same-origin', | |
| headers: new Headers({'Content-Type': 'application/x-www-form-urlencoded'}), | |
| body: 'action=zget_profile_user' | |
| }) | |
| .then((resp) => resp.json()) | |
| .then(function(data) { | |
| if(data.status == "success"){ | |
| _this.setState({loaded:true,user:data.user}); |