Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

ASP button does not fire event after return true from JS function

$
0
0
function AuthUsr() {
(function ($) {
    var obj = {};
    obj.Usrname = $.trim($("#username").val());
    obj.Pw = $.trim($("#password").val());$.ajax({
        type: "POST",
        url: "../../SessionService.asmx/AuthUsrEntry",
        data: JSON.stringify(obj),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (r) {
            var serresp = r.d
            return run(serresp)

        }
    });
})(jQuery);}

function run(e) {
if (e == false) {
    alert(e)

    MsgNotify('Error', '', 'Invalid Password!', '', '')
    return false;
}
else {
    //$('#login').submit();
    return true;
    __doPostBack('#cmdlogin', '')

};};

 <asp:Button ID="cmdlogin" runat="server" Text="Sign in" OnClick="cmdlogin_Click"CssClass=" pushed button btn-blue" ClientIDMode="Static" OnClientClick="return AuthUsr();" Style="display: block; margin-right: auto; margin-left: auto"UseSubmitBehavior="False" />

I m posting my code and HTML build for the button, I tried postback, submit and other functions,, none worked. I m running the my elements in update panel

I know my problem is in returning and employing the boolean val from AJAX call

Please help


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>