ajax
wrap jquery ajax with Ember.RSVP.Promise, this mixin also has events like:
- ajaxStart be trigged when ajax request start
- ajaxDone be trigged when ajax request finish (success or fails)
- ajaxSuccess be trigged when promise resovle success
- ajaxError be trigged when ajax request fails
- RESTSerializerError be trigged error happen when response data serialize
Table of Contents
Methods
jquery ajax method wrapper, return promise
Parameters:
-
method
Stringrequest method
-
url
Stringrequest url
-
options
Objectajax jquery ajax settings, see http://devdocs.io/jquery/jquery.ajax
Returns:
deleteSerializer
-
data
delete method response data serializer
Parameters:
-
data
Objectresponse data
Returns:
serializer data
getSerializer
-
data
get method response data serializer
Parameters:
-
data
Objectresponse data
Returns:
serializer data
postSerializer
-
data
post method response data serializer
Parameters:
-
data
Objectresponse data
Returns:
serializer data
putSerializer
-
data
put method response data serializer
Parameters:
-
data
Objectresponse data
Returns:
serializer data
RESTSerializer
-
data
all ajax response data serializer
Parameters:
-
data
Objectresponse data
Returns:
serializer data
Properties
ajaxSettings
Object
ajax request setting See http://devdocs.io/jquery/jquery.ajax
Default: {dataType: 'json'}
needSerializedMethod
Object
if contentType is application/json which method request data need to be serialized with json
Default: ['post', 'put']
request
Object
wrapper all request method (get put post delete) into request object
Default: {Object}