javascript - How to set boolean value true/false in to backbone model attribute -
i trying set boolean value model attribute follows :
investadjustcollection.models[i].set({isuploaded:false});
this creates problem when send request server take action on modes data following exception @ client level
uncaught syntaxerror: unexpected token <
and @ server level
post http://localhost:8080/api/trade/createinvestadjust 400 (bad request)
if remove investadjustcollection.models[i].set({isuploaded:false});
server call made without issue.
so how set boolean value true/false in bakcbone model.
first guess unknown reasons (validation failed? bug in server code?), when send data, server throws exception , instead of responding valid json response, response body html error page error message, when backbone tries parse json, it's invalid. check server side logs. though saying bad request, suspect exception in server. however, sure, use developer tools examine headers , body of put request browser , make sure content-type correct , request body valid json.
Comments
Post a Comment