In this article we will see how to call blazor function from javascript in Blazor WebAssembly Application
Razor Code
To call blazor function from javascript we must have to make it static and JSInvokable
[JSInvokable] public static void UpdateData(string para1, string para2) { //CODE }
Jquery Code
DotNet.invokeMethodAsync('BlazorApp', 'UpdateData', para1, para2); //BlazorApp - Your Application DLL Name //UpdateData - Function Name [JSInvokable]
Note:
Check how to Update Model data from JSInvokable method here
Post Comments(0)