Why is return function different after click
<p>In following code <code>$('body').delegate('.submit',... passed = search &amp;&amp; passed; ...</code> after click on button in form i have in var <code>passed</code> output as <code>true</code> in case var <code>result</code> in function search is <code>false</code> because data is '0'. How can fix it?</p>

<pre><code>   function search(e) {
       e.preventDefault();
       $('input').live('keyup change', function () {
           var result = true;
           $.ajax({
               type: 'POST',
               dataType: 'json',
               url: 'myUrl',
               data: myData,
               async: false,
               cache: false,
               success: function (data) {
                   //in the here data is 0
                   if (data == 0) {
                       alert('data is 0')
                       result = false;
                   } else {
                       alert('data is not 0')
                   }
               }
           })
           alert(result) // Output this alert is 'false' because data is '0'
           return result;
       })
   }
   $('.myclass_1').live('click', search);
   $('.myclass_2').live('keyup change', search);

   $('body').delegate('.submit', 'submit', function () {
       var passed = true;
       //passed = required_selectbox() &amp;&amp; passed;
       //passed = required_rediuses() &amp;&amp; passed;
       passed = search &amp;&amp; passed;
       alert(passed); // This output is always 'true' !!!!!!!!!!!!!?
       if (!passed) {
           $('#loadingDiv, #overlay').hide();
           return false;
       }
   });
</code></pre>
