jQuery 1.0.4 New Wave Javascript(js源文件)

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

     * (e.g. “xml”, “html”, “script”)
     */
    httpData: function(r,type) {
        var ct = r.getResponseHeader(“content-type”);
        var data = !type && ct && ct.indexOf(“xml”) >= 0;
        data = type == “xml” || data ? r.responseXML : r.responseText;
        // If the type is “script”, eval it in global context
        if ( type == “script” ) {
            jQuery.globalEval( data );
        }
        // Get the JavaScript object, if JSON is used.
        if ( type == “json” ) eval( “data = ” + data );
        // evaluate scripts within html
        if ( type == “html” ) jQuery(“<div>”).html(data).evalScripts();
        return data;
    },
    // Serialize an array of form elements or a set of
    // key/values into a query string
    param: function(a) {
        var s = [];
        // If an array was passed in, assume that it is an array
        // of form elements
        if ( a.constructor == Array || a.jquery ) {
            // Serialize the form elements
            for ( var i = 0; i < a.length; i++ )
                s.push( a[i].name + “=” + encodeURIComponent( a[i].value ) );