Backbone.js sync using post variables, not json

I am new to the backbone and trying to write an html5 interface for the existing (and rather large) end of REST. I found that when saving the model, the base station sends a JSON encoded model by default, which my existing API does not support. Is it possible to send a simple simple mail request with variables using the trunk?

+4
source share
1 answer

I think you are looking for Backbone.emulateJSON = true

copied from official documentation:

If you are working with an outdated web server that cannot handle requests encoded as application / json, setting Backbone.emulateJSON = true; we will cause JSON to be serialized under the model parameter, and the request to create an application with the mime type / x -www-form-urlencoded, as if from an HTML form.

+4
source

Source: https://habr.com/ru/post/1411744/


All Articles