Jquery 错误Errno::ECONABORTED:计算机中的软件中止了已建立的连接
我正试图通过jQuery向Rails控制器发送post请求这是post请求:Jquery 错误Errno::ECONABORTED:计算机中的软件中止了已建立的连接,jquery,ruby-on-rails,json,Jquery,Ruby On Rails,Json,我正试图通过jQuery向Rails控制器发送post请求这是post请求: $(document).ready( function() { $("#LogIn").submit(function() { var myemail = $('input[name=Email]').val(); var mypassword = $('input[name=Password]').val(); var
$(document).ready(
function() {
$("#LogIn").submit(function() {
var myemail = $('input[name=Email]').val();
var mypassword = $('input[name=Password]').val();
var myObj = {
"user": {
"email": myemail,
"password": mypassword
}
};
$.ajax({
url: "localhost:3000/user/HendelLogIn",
type: "POST",
data: myObj,
dataType: "application/json"
success: function(data) {
alert(data);
}
});
});
}
);
</script>
如您所见,此操作将_重定向到以下操作:
def profile
@User = User.find(params[:id])
if @User
respond_to do |format|
format.json {render :json => @User }
end
end
end
这会将Json响应返回到jQuery post,但在此过程中,rails控制台中出现以下错误:
Redirected to localhost:3000/user/1/profile
Completed 302 Found in 140ms (ActiveRecord: 1.0ms)
[2014-09-02 14:12:03] ERROR Errno::ECONNABORTED: An established connection was aborted by the software in your
主机
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:396:in `write'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:396:in `<<'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:396:in `_write_data'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:368:in `send_body_string'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:249:in `send_body'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:152:in `send_response'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:110:in `run'
c:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
javascript和样式表标记可能有问题 删除application.html.erb中标题部分的所有标记
希望这能解决你的问题 检查internet连接你不应该用大写字母Hendellogi命名方法你认为这就是问题所在吗?关于internet连接-我在本地主机上工作
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:396:in `write'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:396:in `<<'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:396:in `_write_data'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:368:in `send_body_string'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:249:in `send_body'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:152:in `send_response'
c:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:110:in `run'
c:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'