How to return false in javascript function from JQuery calling [web method] in asp.net
<p>So in default.aspx I have the code</p>

<pre><code> &lt;script type="text/javascript"&gt;
    function validateForm() 
            {     

        test();
        //here should return true or false and exit validateForm so not to run InsertUpdateData()

    InsertUpdateData()

        }

  &lt;/script&gt;     


&lt;script language="javascript" type="text/javascript"&gt;

(function test() {
    var areaId = 98;
    $.ajax({
        type: "POST",
        url: "GridViewData.aspx/GetRegions",
        data: "{areaId:" + areaId + "}",
        //data:99 ,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function artybones(data) {
            // alert(data.d);
            if (data.d == "Foo 98")
            { alert("its true"); }
            else
            { alert("its false"); }

        }
    });
});     

&lt;/script&gt;
</code></pre>

<p>in GridViewData.aspx I have</p>

<pre><code>&lt;script runat="server"&gt;     

    [WebMethod]     
    public static string GetRegions(int areaId)     
    {        
        return "Foo " + areaId;     
    } 

    &lt;/script&gt; 
</code></pre>

<p>When I call test() from javascript i want it to return false but cant seem to geta value from test. Can someone post the code to do this? I know i am close..thanks in advance to those who post..</p>
