javascript - how to pass multiple arguments to onSuccess function in Prototype? -


I'm beginning to use the prototype library. I want to know how can we pass on many successes in the prototype / on-the-break success? For example: -

  New Ajax Success on: 'testurl', {method: 'post', parameters: {param1: "a", param2: "b", param3: "c"}, fnSccs, performer: fnFail})  < / Pre> 

my success function fnSccs: -

  function fnSccs (response) {warning (response.responseText); }  

I want to give a new argument for the fnSccs function. How is that possible? Thanks for any help.

You can convert your success function to another that receives the desired parameter, and back to its old Returns the job:

  New Ajax Success on mySuccess ('myValue1', 'myValue2'), request ('testurl', {method: 'post', parameters: {param1: "a", param2: "b", param3: "c"}, onfile : FnFail}) mySuccess (param1, param2) function {return function (feedback) {// your old success function warning (param1); // parameter is still accessible here (paragraph 2); Warning (feedback); }}  

What happens when you call mySuccess (...) , your old function is returned, but still have access to parameters Because variables

you can see the ongoing snippets.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -