function getvalue(value) {
        document.getElementById('<%= hdnPack.ClientID %>').value = "0";
        var stdPack = 0;
        alert("a");
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            url: "test.aspx/GetStdSellingPack",
            data: "{'Col1':'" + value+ "'}",
            dataType: "json",
            success: function (data) {
                alert("b");
                if (data != null) {
                    $(data).each(function () {
                        var values = data.d;
                        stdPack = values;
                    });
                }
            },
            error: function (result) {
                alert("Error");
            }
        });
        alert("c");
        return stdPack;
    }
Am trying to execute this function Always returning zero , Actually what happening Alert(a) got Fired ,Then Alert (C) fired And Suddenly it goes to Alert(b). The result I would like to get In order, Alert(a) to execute first then Alert(b) followed by alert(c).Pl give me a solution .Thanks in Advance
 
     
     
    