asp.net - Weird Asynchronous Javascript & WebMethod Behavior -
asp.net - Weird Asynchronous Javascript & WebMethod Behavior -
i'm calling pagemethod in javascript. this:
function deletebatchjs2() {$find('mdlpassword').hide(); var pswd = $('#txtpassword').val(); var userinfo = get_cookie("userinfo"); pagemethods.authenticateanddelete( userinfo, pswd, onsuccess(), onerror1()); } function onsuccess(result) {alert(result);} function onerror1(result) {alert(result);}
now here's unusual part: 1 think calling pagemethods give 1 (1) alert when running. either onsuccess function or onerror1 function. -- 2 alerts, both saying "undefined".
as matter of fact, when set breakpoint in vb code-behind (like 3rd or 4th line of code in function), both alert boxes before can step code behind. 2 alerts, , code breaks.
this makes no sense me. missing anything?
thanks,
jason.
p.s. -- here's source webmethod function. please note create wcf call.
<webmethod()> _ public shared function authenticateanddelete(byval userinfo string, byval password string) boolean dim client new letterwriterclient dim bo new batchoperations dim usernumber string dim username string 'extract user name , number user info cookie string username = getvaluefromvbcookie("username", userinfo) usernumber = getvaluefromvbcookie("usernumber", userinfo) 'now validate user if bo.validateactivedirectorylogin("backoffice", username, password) authenticateanddelete = client.delete_dat_batchsql(usernumber) client.close() else authenticateanddelete = false end if end function
should be:
pagemethods.authenticateanddelete( userinfo, pswd, onsuccess, onerror1); }
javascript asp.net asynchronous webmethod pagemethods
Comments
Post a Comment