need explaination of jquery ajax.success paramters

Posted by user1575229 on Stack Overflow See other posts from Stack Overflow or by user1575229
Published on 2012-09-23T21:30:23Z Indexed on 2012/09/23 21:37 UTC
Read the original article Hit count: 478

Filed under:
|
|
|
 case 'ajax':
                busy = false;
                $.fancybox.showActivity();
                selectedOpts.ajax.win = selectedOpts.ajax.success;
                ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
                    url : href,
                    data : selectedOpts.ajax.data || {},
                    error : function(XMLHttpRequest, textStatus, errorThrown) {
                        if ( XMLHttpRequest.status > 0 ) {
                            _error();
                        }
                    },
                    success : function(data, textStatus, XMLHttpRequest) {
                        var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
                        if (o.status == 200) {
                            if ( typeof selectedOpts.ajax.win == 'function' ) {
                                ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);

                                if (ret === false) {
                                    loading.hide();
                                    return;
                                } else if (typeof ret == 'string' || typeof ret == 'object') {
                                    data = ret;
                                }
                            }

                            tmp.html( data );
                            _process_inline();
                        }
                    }
                }));

            break;

Can anyone please explain what is going on in this code

  1. selectedOpts.ajax.win = selectedOpts.ajax.success; what is happening here?and what is the usefulness?
  2. ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest); what is happening here? what does the win() method call.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui