Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

How to return a value from Controller methods

$
0
0

I have this:

Copy code
  1. $.Controller.extend("TestController",
  2.         /* @static */
  3.         {
  4.             defaults: {
  5.      
  6.             }
  7.         },
  8.         /* @prototype */
  9.         {
  10.                  
  11.              /* *** SOME STUFF *** */

  12.               returnValue: function() {
  13.                         alert("hi");
  14.                         return 10;
  15.               }  
  16.         }
  17. );

I create this controller on an element and then try to call the "returnValue" method in order to get a value like this:

Copy code
  1. $("#test").test_controller("returnValue")

 I know it fires because I get the alert, but the only thing that is returned is a reference to the controller element object:

Copy code
  1. [div#test.test_controller]

How do I get the return value?


Viewing all articles
Browse latest Browse all 3491

Trending Articles