I have a variable called "cb" in my C# class file, I want to use it in my HTML page using JavaScript function.
Here Is my C# code
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
string str = "ms-appx-web:///homepage.html";
wview.Navigate(new Uri(str, UriKind.Absolute));
}
public string cb = "";
public async void init(object sender, NotifyEventArgs e)
{
string val = e.Value;
if (val == "picture")
{
try
{
cb = await ocrchild.picture();
Debug.WriteLine("Image saved at :- " + cb);
}
catch (Exception ee)
{
Debug.WriteLine(ee.Message);
}
}
}
}
and this is my html code, I want that cb to be in stored in i4 variable, Can you help me with this?
<script>
function CallNative()
{
var i1=document.getElementById("id1").checked;
var i2=document.getElementById("id2").checked;
var i3 = document.getElementById("id3").checked;
var i4 = "";
if(i1== true)
{
window.external.notify("picture");
}
if (i2 == true) {
window.external.notify("ocr");
}
if (i3 == true) {
window.external.notify("base64");
}
document.getElementById("id4").value = i4;
};
</script>
Thanks in advance.