我是骨干新手。我试图在服务器上保存模型,但它给了我
错误:
[HTTP/1.1 403 Forbidden 1010ms]
我缺少的地方?
我的代码是:
<script type="text/javascript" >
var UserModel = Backbone.Model.extend({
url:'http://192.168.1.3:8080/app/profile/astro'
});
var user=new UserModel();
console.log('here ');
user.toJSON();
user.save({
'dob':'89 jan'
},{
wait:true,
success:function(model, response) {
console.log('Successfully saved!');
},
error: function(model, error) {
console.log(model.toJSON());
console.log('error.responseText');
console.log(error);
}
});
</script>
Server code is:
@POST
@Path("/astro")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response addAstro(Astro astro)
{
ResponseBuilder builder = Response.status(Status.INTERNAL_SERVER_ERROR);
try
{
profileBusinessServiceImpl.saveAstro(astro, "52f5c59884aedfe7e051fd38");
builder.status(Status.OK);
}
catch (Exception e)
{
}
return builder.build();
}
我用邮递员测试了我的服务。它的工作。