Thursday, December 17, 2009

Re: [jQuery] Re: How to compare data in 2 jQuery data() elements

I think you guys are making this too complicated. Just loop through the data properties:

    function dataChanged( a, b ) {
        for( var key in a )
            if( a[key] != b[key] ) return true;
        return false;
    }

    if( dataChanged(o,n) ) {
        someAJAXFunctionThatSavesTheFieldsThatChanged();
    }

-Mike

On Thu, Dec 17, 2009 at 5:58 AM, discern <capneb@gmail.com> wrote:
Thanks. I'll give that a go. Otherwise, I'll just write 2 different
functions: one for comparison (I'll probably compare hashes using the
sha1 plugin) and one for sending the data to the backend.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate