Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Ajax Programming

Curious how to use a variable to call it as a function


I have an ajax function that can be called by more than one part of my
web application, so I would like to have some sort of callback
function.

So, here is one function:
         showCardsInPopup:function(e) {
           Card.callbackFunc = Reader.displayCardsInPopup;
           Card.getCardsByDeckId(e);
         },

Card.callbackFunc is to be used when I get the response from the ajax
call, but I need to call the function with parameters.

So, how can I some something like:

var myObj = "some object returned from server";
callbackFunc(myObj);

I could build it up as a string, and call eval, but I don't really
like that approach, and hope there is a better way.

Thank you.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc