I have a page reference method in the Apex controller which is exposed as REST API.

The page reference method gets invoked and below is the syntax:

    PageReference myVFPage = new PageReference('/apex/VFPageName=' + vfPageId);
    myVFPage.setRedirect(true);

For the `Pagereference` method, I had set the return type as `VFPageName`.

The method is getting executed with no errors how ever the VisualForce page is not loading.

How can I make sure the VisualForce page gets loaded and the JavaScript events gets fired during the page load?