Razor Page with Partial View Not Refreshing using Jquery load

41 Views Asked by At

I have a razor page with dotnetcore 6 with a partial view that is not reloading. All seems to operate correctly - the page hits the partial code on the index and returns without error but in devtools I see a 500 internal server error with a policy of strict-origin-when-cross origin.The requested URL is not different from the initial URL except for the handler.

The page is updated from a setInteveral timer using jquery load.

<div id="report1">
    <partial name="report"  />
</div>

In the layout.cshtml I have

 function settimer() {
        timerhandle=setInterval(CycleMap, 10000);
         
    }


    function CycleMap() {

   
        $('#report').load('Index?handler=Partial');
       

       if( $("#div1").css('display') == 'block'){
              $( '#div1' ).hide();
              $('#div2').show();
        }
        else {
          $( '#div1' ).show();
          $('#div2').hide();
         
        }

    }

The partial code is hit when I debug

public PartialViewResult OnGetPartial()
{
    alldata = _returnWBData.ReturnAllWBData();
    alldata.pricedata = _tickerService.GetPrices();
    return Partial("report", alldata);


}

however none of the data on the partial is updated. In the devtools of chrome or edge, I see the 500 Internal server error on the Url : https://website.com/newrazorpage/Index?handler=Partial

What is causing that error?

0

There are 0 best solutions below