jQuery 1.0.4 New Wave Javascript(js源文件)

2020-05-19 07:32:46易采站长站整理

    ajax: function( s ) {
        // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
        s = jQuery.extend({
            global: true,
            ifModified: false,
            type: “GET”,
            timeout: jQuery.timeout,
            complete: null,
            success: null,
            error: null,
            dataType: null,
            url: null,
            data: null,
            contentType: “application/x-www-form-urlencoded”,
            processData: true,
            async: true,
            beforeSend: null
        }, s);
        // if data available
        if ( s.data ) {
            // convert data if not already a string
            if (s.processData && typeof s.data != ‘string’)
                s.data = jQuery.param(s.data);
            // append data to url for get requests
            if( s.type.toLowerCase() == “get” )
                // “?” + data or “&” + data (in case there are already params)
                s.url += ((s.url.indexOf(“?”) > -1) ? “&” : “?”) + s.data;