Click to See Complete Forum and Search --> : calling a script and reloading a page


jub7
02-17-2003, 07:13 AM
I would like to call a third party script on form submition and load my own page after that.

Cannot find an answer so far, is it so hard to do?

Nevermore
02-17-2003, 07:17 AM
Put the script in the head of the page, or add to the script so that it redirects the browser.

khalidali63
02-17-2003, 07:17 AM
Originally posted by jub7
..... call a third party script on form submition ........

Would you care to elaborate,Just saying third party script does not ring any bells at all..

:-)
a bit more detail on events and script loading before and after form submission would be help full

Khalid

jub7
02-17-2003, 11:32 AM
I have to call a third party script that takes input from a form.

The script returns some textual information (some codes which i can't show to users. )

Ideally I would like to process the output and display a page with results.

I have no control over the scripts (a bank appl.)

I tried to call the url in onload but doesn't work.
:((


I am looking for a quick way to call the scripts, including use of asp.

khalidali63
02-17-2003, 11:56 AM
I still am not cear on third party script.

anyways here what I understood and made a solution accordingly.

create a javascript file which i named as
"thirfparty.js"

then import this file

and have rest of the code .
Below is the contents of
"thirdparty.js" file .


function processData(val1,val2){
return new Array(val1*2,val2+6);
}



Then I have all this code in an html page


<script type="text/javascript" src="thirdparty.js"></script>
<script type="text/javascript">
function process(){
var frm = document.form1;
var text1 = frm.text1.value;
var text2 = frm.text2.value;
var result = processData(parseInt(text1),parseInt(text2))
alert("values returned from .js file processing\n"+
text1+" * 2 = "+result[0]+", "+text2+" + 6 ="+result[1]);
}
</script>
</head>

<body>
<form name="form1" action="">
<input type="Text" name="text1" class="text"></input><br>
<input type="Text" name="text2" class="text"></input><br>
<input type="Button" class="button" value="Button" onclick="process();"></input><br>
</form>



Cheers

Khalid

jub7
02-17-2003, 12:04 PM
Great, thanks Khalid

Two things, the scipt is a cgi one called

http://thirdserver..../scr.cgi?data&data


and after the user submits the form, and the scipt returns my next page should load. How do I do that?

khalidali63
02-17-2003, 12:12 PM
instead of the alert()
use this code

document.location.href = "yourNextPagesURL.html"

this will load the next page.

jub7
02-17-2003, 01:45 PM
That's great for reloading the page
but i cannot call the sript like that

ALL i have is a url.. to call which results I have to wait....


I don't know if I can invoke a CALL like a procedure in a code and get the results,

there should be some way to do this call..

something like that wont help

<script type="text" src=htpps://url/cgi-bin...></script>
J

khalidali63
02-17-2003, 02:11 PM
As I said your question has been ambiguous all along.
if you want to send the values to a cgi script then you must know the cgi applications address,once you do that then u should be able to perform the rest of the task.

MY guess is ( me no CGI expert)
you should be able to do something like this
document.location.href = /cgi-bin/form-process/?value1="+val1+"&value2="+val2;

As I see it, it should then return the results to the same page that actually sent the data.

I hope some CGI expert sees this and get you out of this problem..

cheers

Khalid

Nevermore
02-17-2003, 02:30 PM
Why not post in the CGI forum?