Don't change text in Web Method. You can easily do that in Success Block.
success: function(data) {
var theHtml = data.d;
if(data.d=="loginerror")
{
alert('Username or password is incorrect');
}
else
{
document.getElementById('LoginBtnValue').value = "Logoff";
window.location.href = data.d;
}
},
[Update after OP's Reply]
Quote:
I have <a href="3" class="login">login
now i want to make login as logoff and not button,
but from jquery , if i do this , it will refresh page and keep original values and not new value which we give
Okay do one thing. If page refreshes, it will show "
Login" again. To resolve that, you can do one thing.
Pass one
QueryString along with the
data.d
. Let's try the below...
if(data.d=="loginerror")
{
alert('Username or password is incorrect');
}
else
{
window.location.href = data.d + "?loginText=Logoff";
}
Provided
data.d
is a Page
URL
. So, we have one
QueryString. Now we just need to read it on that
Page Load
and assign that to the
Login link by
jQuery/JavaScript.