I am trying to add an ajax function to a webpage and executed it using C#. Here it is my code:
HtmlElement head = webBrowser1.Document.GetElementsByTagName("head")[0];
HtmlElement scriptEl = webBrowser1.Document.CreateElement("script");
IHTMLScriptElement element = (IHTMLScriptElement)scriptEl.DomElement;
element.text = "function sayHello() { $.ajax({type: 'GET', url: '/gres/ajax/archive-odds.php',data:'&outcome='+'27498xv498x0x0'+'&provider='+'14',cache:!1,dataType:'xml', success: function (data) { alert('sucess'); }, complete: function () {} }); $('body').html(); }";
head.AppendChild(scriptEl);
object res = webBrowser1.Document.InvokeScript("sayHello");
My code, doesn't gave me any error. But the res object is always null. Can anybody help me??
Thanks