Hello,
I have a scenario where the ajax actionlink text is 'Apply'..On clicking this and calling an action, i want the link to be disabled and to be changed to 'Application successful'.
How can i do this?
Thanks
Hello,
I have a scenario where the ajax actionlink text is 'Apply'..On clicking this and calling an action, i want the link to be disabled and to be changed to 'Application successful'.
How can i do this?
Thanks
You could use OnSuccess:
<%= Ajax.ActionLink("Apply", "Apply", new AjaxOptions { 
    OnSuccess = "myCallback"
}) %>
and then implement the function:
function myCallback() {
    this.innerHTML = 'Application successful';
    this.onclick = function () {
        alert('Already done');
        return false;
    };
}
By the way is there any reason for using the intrusive MS AJAX instead of jquery and normal Html.ActionLink:
<%= Html.ActionLink("Apply", "Apply", null, new { id = "apply" }) %>
And then in a separate js:
$(function () {
    $('#apply').click(function () {
        var a = $(this);
        $.get(this.href, function () {
            a.text('Application successful').unbind('click').click(function () {
                alert('Already done');
                return false;
            });
        });
        return false;
    });
});