model.attr(attribute, value, success, error) -> undefined
{String}
the attribute you want to set or get
{optional:String|Number|Boolean}
value the value you want to set.
{optional:Function}
an optional success callback.
This gets called if the attribute was successful.
{optional:Function}
an optional success callback.
The error function is called with validation errors.
{undefined}
Gets or sets an attribute on the model using setters and getters if available.
Setters
If you add a setAttributeName method on your model, it will be used to set the value. The set method is called with the value and is expected to return the converted value.
Asynchronous Setters
Sometimes, you want to perform an ajax request when you set a property. You can do this with setters too.
To do this, your setter should return undefined and call success with the converted value. For example:
Events
When you use attr, it can also trigger events. This is covered in jQuery.Model.bind.