title: assign function return value to some variable using javascript
body: <p>I have a js function , after doing some business logic, the javascript function should return some result to another variable.Sample code below</p>
  
  <pre><code>var response="";
  function doSomething() {  
      $.ajax({
          url:'action.php',
          type: "POST",
          data: dataString,
          success: function (txtBack) { 
              if(txtBack==1) {
                  status=1;
              }
      });
      return status;     
  }
  </code></pre>
  
  <p>Here i want to use like </p>
  
  <pre><code>response=doSomething();
  </code></pre>
  
  <p>I want to assign a return value "status"  "var response".But the result is 'undefined'.</p>