-1
Webページにajax関数を追加しようとしていて、C#を使用して実行しました。ここに私のコードです:Script InjectionはC#を使用してnullを返します
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");
私のコードは、何かエラーをされていません。しかし、resオブジェクトは常にnullです。誰も私を助けることができますか?
ありがとうございました
のようなものを試してみてください? –
いいえ、このようなものを試すことができますhttp://stackoverflow.com/a/2592780/2921949 –