Can't use redirectToPage() within an Ajax request

Hi

I have a button with serverside javascript and the button is attached with “Partial Update”.

Upon clicking on the button, it validates and creates a new document & redirect to new page. Everything is ok except “redirectopage”. I am getting an error message like “Can’t use redirectToPage() within an Ajax request” on the server console.

I appreciate, if anyone gives me some solution. TY !

Regards,

Karthik KS