Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > simulating/calling javascript functions programmatically

Reply
Thread Tools

simulating/calling javascript functions programmatically

 
 
=?Utf-8?B?WVI=?=
Guest
Posts: n/a
 
      01-22-2004
Hello,

I am tasked to write an application for a travel agency, that should be able to get a price for airline tickets from airline's website. Generally, airlines don't provide any web services for this, so I am sort of forced to simulate all the clicks/list boxes selection that a regular user would make. Most of those buttons have a java script associated with them, so as soon as a button's clicked -- java script runs.

So, here is the question: what's the best way to implement a call to a javascript? Would I use ASP.NET platform, since it has these HttpRequest / Response objects? What would I put in my HttpRequest?

For instance, if a web page http://www.mysite.com/page.cgi has a java script that looks something like this:

function submit_SomeForm()
{
document.SomeForm.A.value = "A"
document.SomeForm.B.value = "B"
document.SomeForm.C.value = "C"

document.SomeForm.submit()
}

What would be a code snippet that would setup SomeForm document with all the values and submit it to the site?
Also, what tools would I use to see what the http string that goes from my browser to the site is like?

I understand that I am sort of asking for a lot but I appreciate any help -- I am a rookie at this and it's tough to ask the right question

I appreciate any help.

Sincerely,
YR
 
Reply With Quote
 
 
 
 
Scott Allen
Guest
Posts: n/a
 
      01-22-2004
Take a look at the WebRequest class which will allow you to do GET and
POST. For example, here is a sample doing a POST :
http://samples.gotdotnet.com/quickst...lientPOST.aspx

One of the first tools I would get for debugging would be something
like tcpTrace (see http://www.pocketsoap.com/tcptrace/). This easily
allows you to see all the traffic between yourself and a web site. You
can compare what your code is sending versus what the browser sends.
Even before debugging, it will show you a little bit about what
happens on the form.submit call.

HTH,

--
Scott
http://www.OdeToCode.com

On Wed, 21 Jan 2004 22:56:06 -0800, "YR"
<> wrote:

>Hello,
>
>I am tasked to write an application for a travel agency, that should be able to get a price for airline tickets from airline's website. Generally, airlines don't provide any web services for this, so I am sort of forced to simulate all the clicks/list boxes selection that a regular user would make. Most of those buttons have a java script associated with them, so as soon as a button's clicked -- java script runs.
>
>So, here is the question: what's the best way to implement a call to a javascript? Would I use ASP.NET platform, since it has these HttpRequest / Response objects? What would I put in my HttpRequest?
>
>For instance, if a web page http://www.mysite.com/page.cgi has a java script that looks something like this:
>
>function submit_SomeForm()
>{
> document.SomeForm.A.value = "A"
> document.SomeForm.B.value = "B"
> document.SomeForm.C.value = "C"
>
> document.SomeForm.submit()
>}
>
>What would be a code snippet that would setup SomeForm document with all the values and submit it to the site?
>Also, what tools would I use to see what the http string that goes from my browser to the site is like?
>
>I understand that I am sort of asking for a lot but I appreciate any help -- I am a rookie at this and it's tough to ask the right question
>
>I appreciate any help.
>
>Sincerely,
>YR


 
Reply With Quote
 
 
 
 
Lachlan Gemmell
Guest
Posts: n/a
 
      01-23-2004
I had a similar query (actually posted it just before yours) and found my
answer in the Page.RegisterClientScriptBlock method. It lets you add client
side Javascript to your page from within your server side ASP.NET code.

Regards,

Lachlan


 
Reply With Quote
 
=?Utf-8?B?WVI=?=
Guest
Posts: n/a
 
      01-27-2004
Thanks.

YR
 
Reply With Quote
 
=?Utf-8?B?WVI=?=
Guest
Posts: n/a
 
      01-27-2004
Thanks.

YR
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically Include Link to External Javascript File In Master Page Joey ASP .Net 5 06-18-2007 05:23 PM
How do I programmatically (javascript) check if link is valid in html? Chandra ASP .Net 8 03-24-2007 09:02 PM
How do I programmatically (javascript) check if link is valid in html? Chandra HTML 3 03-07-2007 09:00 PM
Programmatically click asp.net button via javascript? Cathryn Johns ASP .Net 6 11-03-2005 07:28 AM
please help me in distinguish redefining functions, overloading functions and overriding functions. Xiangliang Meng C++ 1 06-21-2004 03:11 AM



Advertisments