Skip to content

Unable to show toast after ajax call completion. #10

@AhmadHassanSahi

Description

@AhmadHassanSahi

I want to show my toast when ajax calls return after completion. I tried to do it in Controller Action Method but it does not work

function GetOneDriveFileDownloadURL() {
        $("body").addClass("loading");
        $.ajax({
            type: "GET",
            url: "/Ajax/GetOneDriveFileDownloadURL",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            error: function (xhr, status, error) {
            }
        }).done(function (data) {

            var link = document.createElement('a');
            link.href = data;
            link.download = "Test.txt";
            link.dispatchEvent(new MouseEvent('click'));
            $("body").removeClass("loading");

        });
    }

> API Success Call

``
if (OneDriveApi.AccessToken.AccessToken != null)
                {
                    if (fileOneDriveItem != null)
                    {

                        _notifyService.Success("This is a Success Toast",100000);
                        return new JsonResult(fileOneDriveItem.DownloadUrlAnnotation);

                    }
                }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions