On Tue, Oct 20, 2009 at 5:06 AM, gMinuses <gminu...@gmail.com> wrote:

>
> Like I said: setting data property in ajaxSetup won't work, if it's
> specified
> in individual ajax calls.
>

if it's specified in individual ajax calls you don't need defaults then,
otherwise append data in the url or set the data extending original one.

// custom method
jQuery.ajaxSettings.ext = (function(anonymous){
    return function ext(o){
        anonymous.prototype = this.data || {};
        var k, result = new anonymous;
        if(o){
            for(k in o)
                result[k] = o[k]
            ;
        };
        return result;
    };
})(Function());

// your defaults
jQuery.ajaxSetup({
    data:{
        defaultKey:"defaultValue",
        otherKey:"otherValue"
    }
});

console.log(jQuery.ajaxSettings.ext({test:123}));

Regards

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to