0

I am trying to pass associative array to functions in a jquery plugin. Just as the answer from this question.

And this is my plugin and how I execute it on dom ready. You can have a look at jsfiddle.

The plugin works fine on firefox only but fails on chrome, opera and safari. I don't understand why!

In chrome, the javascript console says there are two errors in these lines,

an error in the plugin, error message,

Uncaught SyntaxError: Unexpected token :

// Callback function for proccesing the result.
$this.get_result = function({object:object,setup:setup,data:xml}) {...

and another error in dom ready,

Uncaught SyntaxError: Unexpected token {

beforeAjax: function({setup:setup,object:form}) {...

Can somebody tell me what I have done incorrectly?

1 Answer 1

0

Some syntax errors ....

    // Set the default values, use comma to separate the settings, example:
        var defaults = {
            setup:                  {},
            beforeAjax:             function() {},
            onAjaxSuccess:          function() {},
            onError:                function() {},
            onSuccess:              function() {}
        //  }  // <--- Extra bracket
        };   // <-- should have semi colon

defaults object has extra curly bracket ... should really have semi colon after var declaration

Hope this helps

Sign up to request clarification or add additional context in comments.

1 Comment

thanks for the answer. i updated it but still get the same errors... jsfiddle.net/sKKGQ/1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.