text: Q:
  
  Ajax. How can I return value?
  
  I want set result to variable from MVC controller method.
  function someFunction(){ 
      var result;
      $.Ajax{    
          //??? 
      }
      return result; 
  }
  
  //In comparison to c++ 
  int f() { //just! return result; }
  
  P.S.: It is not async, it should be sync function call in order to return value to the function body.
  
  A:
  
  set up a controller 
  public ActionResult Foo(){
  
  return Content("Hello Anton");
  }
  
  set up the ajax request, remember to make it async:false, which is by default true, in order to return the value 
  function greeting(){
     var x= $.ajax({
              url:'/ControllerName/Foo',
              async:false,    
            });
     return x.responseText();
  }
  
  now you can call the function like 
  var v = greeting();
  alert(v); //if every thing goes well you will see "Hello Anton"
  
  