I'm trying to invoke javascript function in webbrowser. Website have separate file with javascript functions. This is a part of website html file:
<div class="header">
<a class="buttonrg" onclick="$(this).hide();remove('56442741')"> Remove </a>
</div>
This is remove function from .js file:
function remove(id) {
$.ajax({
type: "POST",
url: "ajax/remove.php",
data: "remove=" + id
});
}
And I'm trying to call 'remove' function with this script in c#:
public void RemoveOffer(int _id)
{
try
{
webBrowser.Document.InvokeScript("remove", new object[] { _id.ToString() });
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
but always when I'm trying to call this script console is showing me an error: specified cast is not valid.
What could went wrong?