Executing a javascript function client side with Jquery ASP.Net and C#

Question!

I want to pull some data from a page containing a javascript function taking parameters including the this paramter ex: displayNav('11512010', 'J88903', 'itna', this, 'detailSpec','false','true'); My first issue is that I am not sure what I should do with the this object. I want to execute the script and get back the result somehow. I am using C#, ASP.Net, Active X webbrowser control and JQuery. I have limited experience with javascript and am totally new to JQuery. Is this sort of thing possible with JQuery? Here is the entire function

  onclick="displayNav('11512010','J88903', 'itna', this, 'basicSpec','false','true'); return false;


Answers

Looks like your best bet would be to use some kind of asmx web service. Then you could have a function in your web service with parameters and you would get a JSON response back htat you could use in jquery. Look at www.encosia.com for posts on calling web services from jquery. Specifically http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/



Apparently, you've got a page that includes this function. You need to scrape the version of the page that exists after this function is called (perhaps, after the click). You want to do this from a program or other web page.

You cannot make a request to a web server that says, "get me this page, then click the button, and give me the result". Only a web browser can click the button and execute the javascript and produce different HTML for you to scrape. You need a solution that allows a program to force a browser to get the web page, then click the button, then get the result.

In .NET, you should use the Windows Forms WebBrowser control, which can do all of this.



This video can help you solving your question :)
By: admin