How to make "import demo in one click" option ?

Hi all,
I am coding a wp theme to be published in themeforest, and I need to have the option “import demo in one click” to import one of the demo pages like many others themes, can someone please tell me how to get this functionality ? thanks

Here’s a good script to use:

And here’s the link to corresponding discussion in themeforest:

Big thanks uiuxaesthetics, I will check this out