views:

336

answers:

2

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;
A: 

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/

Chris Westbrook
Thanks I will check that out, So you are saying the asmx web service would contain the function in the web service that I can send params to and then, whatever this JSON response is contains my result information?
note I do not have acces to the actual web server I am simply connecting over the net. This is not a development for a service I want to create on a site I have personal control over. I cannot create services for this.
This is not possible. If the page won't call displayNav for you and produce the results, then you can't force it to do so.
John Saunders
noooo, the page DOES call it, my point is I cannot extract it! Because the html source does not contain it therefor I need access the DHTML object, the page uses javascript to dynamically load this value
Are you talking about screen-scraping?
John Saunders
yes screen scraping
A: 

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.

John Saunders
Right the function is calling an external file a .js file resident on the client, this is fully a client process. I need to extract the information that the function returns, there is nothing Server here its all local, sorry for the confusion. So basically I want to execute that javascript function,or another, with parameters and then get that resultant information back and store it.
How are you planning to store it? You could use a hidden field, but that is only temporary of course. Long term you'll need a database of some kind.
Chris Westbrook
storage is no problem, access is my only issue. I store it into a database
I'm sorry, you're just not making any sense.
John Saunders
actualy I am making pretty good sense its a difficult probem. This is screen scraping. Is it possible to get values returned by javascript functions on client off the web using Jquery
For some reason this data does not appear in the source html code after the document has completed (ie finished loading). This can be accomplished through OLE COM and Active X but I don't want to deal with that mess.
You really need to rewrite your question from scratch. Look how long it's taken you to get around to admitting this is a screen scraping problem!
John Saunders