When dealing with a Backbone object and making an AJAX call to save it, I often wonder about the different ways the success callback can be handled. Sometimes, I see a generic
success: function (data) {
console.log(data);
Other times, it's more specific like:
success: function (library, response) {
console.log(library);
console.log(response)
It's confusing to know whether you'll receive a library or response object instead of just general data. Analyzing the output of
console.log(response);
I notice that response has attributes such as Notifications, Response, and ResponseStatus. The Response attribute contains something like
Object {Id="12345", href="the/href", Name="asdf"}
Despite this structure, attempting to access response.Name
always returns undefined. This leads me to question how exactly the callback is processed in AJAX calls, especially when working with library objects, response objects, or general data objects. Any insights on parsing these results correctly would be greatly appreciated. Thank you!