React-Rails中的PATCH AJAX请求中的ERR_EMPTY_RESPONSE

我正在尝试通过我的应用程序中的表单更新基本数据库。 通过此AJAX调用处理更新:

handleUpdate (e) { let url = '/sites/' + this.props.site.id; let site = { name: this.refs.name.value, city: this.refs.city.value, state: this.refs.state.value, country: this.refs.country.value, }; e.preventDefault(); $.ajax({ method: 'PATCH', url: url, data: {site: site}, success: (site) => { console.log("success"); } }); } 

控制器:

 def update @site = Site.find(params[:id]) if @site.update_attributes(site_params) redirect_to('index') else render('edit') end end 

当我点击更新时,我收到此错误:

PATCH http:// localhost:3000 / sites / 2 net :: ERR_EMPTY_RESPONSE jquery.self-660adc5 … .js?body = 1:10246

但是,当我刷新页面时,将对数据库进行更新,并显示更新的值。

任何想法为什么会这样? 谢谢!