'update Table on HTML web page on button click in Powershell

I am able to create a HTML page in PowerShell where i convert a array to HTML Table using ConvertTo-HTML cmdlet.. I want to create a "refresh" Button on webpage , when click will update the Table on the Webpage. Basically invoke PowerShell function which gets the array data ,update the data and display on page .

enter image description here

enter image description here

Below is my code :

Function Get-BGPneighbour {

code......

return $BGPneighbour

}

$BGPbutton=@"
<button onclick="Reload()">Refresh</button>
"@


$BGPHTML=$BGPneighbour | ConvertTo-Html   -PreContent "<h2>BGP TABLE for $item</h2> $BGPbutton<br> " -Fragment 

ConvertTo-Html -Title "BGP" -Body "$BGPHTML" -Head $css | Out-File .\BGPneighbour1.html


<html>
 <script>
    function Reload()   {
       Get-BGPneighbour         #   Need help on how can i get the array data and populate on webpage..
        return $BGPneighbour
    </script>

    <button onclick="Reload()">Refresh table</button>
    </html>

I don't know how can i achieve that . .I am attaching my full code just in case required..



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source