|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
call url while keep form parameters
Hi,
I"m writing a page in asp. When the user presses on Submit the form is passed by Post to a url in a different site. The problem is that i want to do this action in script, meaning call a function which will call the url and pass the form by Post. There are : Server.Transfer - passes only to a page in the same site, so no good for me. Response.Redirect - Doesnt pass and form or query parameters so no good for me again :( So how will i do this? Thanks in advance Goldwind wrote:
Show quote > Hi, Why can't you simply apply the URL to the form's action attribute?> > I"m writing a page in asp. When the user presses on Submit the form is > passed by Post to a url in a different site. > The problem is that i want to do this action in script, meaning call a > function which will call the url and pass the form by Post. > > There are : > Server.Transfer - passes only to a page in the same site, so no good for me. > Response.Redirect - Doesnt pass and form or query parameters so no good for > me again :( > > So how will i do this? > > Thanks in advance /P. I want to do 2 operations on submit:
1. call a url (not on my server) 2. send an email. If i will put the url on the action attrubute of the form then it will do 1 but not 2. Show quote "Paxton" wrote: > > Goldwind wrote: > > Hi, > > > > I"m writing a page in asp. When the user presses on Submit the form is > > passed by Post to a url in a different site. > > The problem is that i want to do this action in script, meaning call a > > function which will call the url and pass the form by Post. > > > > There are : > > Server.Transfer - passes only to a page in the same site, so no good for me. > > Response.Redirect - Doesnt pass and form or query parameters so no good for > > me again :( > > > > So how will i do this? > > > > Thanks in advance > > Why can't you simply apply the URL to the form's action attribute? > > /P. > > Goldwind wrote:
> I want to do 2 operations on submit: Submit to a page that first sends the email, and then redirects (using > 1. call a url (not on my server) > 2. send an email. > Response.Redirect) to the remote page. -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM" The problem is that "Response.Redirect" doesnt keep the form and query
parameters so the destination page will not be able to read them. Show quote "Bob Barrows [MVP]" wrote: > Goldwind wrote: > > I want to do 2 operations on submit: > > 1. call a url (not on my server) > > 2. send an email. > > > > Submit to a page that first sends the email, and then redirects (using > Response.Redirect) to the remote page. > > -- > Microsoft MVP - ASP/ASP.NET > Please reply to the newsgroup. This email account is my spam trap so I > don't check it very often. If you must reply off-line, then remove the > "NO SPAM" > > > Goldwind wrote:
> The problem is that "Response.Redirect" doesnt keep the form and query Well, it would be simple enough to add the passed form and querystring > parameters so the destination page will not be able to read them. > values to the url in the Redirect statement, but then you would be subject to the limitations imposed on what can be passed via querystring (there's a size limit on the url as well). See my followup to my original reply. -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM" Goldwind wrote:
Show quote > The problem is that "Response.Redirect" doesnt keep the form and query So you want the Form data available to two separate pages? If that's> parameters so the destination page will not be able to read them. > > > "Bob Barrows [MVP]" wrote: > > > Goldwind wrote: > > > I want to do 2 operations on submit: > > > 1. call a url (not on my server) > > > 2. send an email. > > > > > > > Submit to a page that first sends the email, and then redirects (using > > Response.Redirect) to the remote page. > > the case, it would suggest you want to do some processing on them twice. Why can't you put all the processing code in one page? If my assumption's wrong, can you tell us a bit more about what you are trying to achieve? /P. Bob Barrows [MVP] wrote:
> Goldwind wrote: Oops, I skipped to this reply without reading the OP - sorry.>> I want to do 2 operations on submit: >> 1. call a url (not on my server) >> 2. send an email. >> > > Submit to a page that first sends the email, and then redirects (using > Response.Redirect) to the remote page. I think you are going to need to use client-side code to accomplish this in the form's onsubmit event. Use the xmlhttprequest object to submit your data to the page that sends the email prior to submitting to the url on the remote server. See a client-side scripting newsgroup such as microsoft.public.scripting.jscript for details. (Google should give you many examples of using XMLHTTP) -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM" One option is to post to the page on your server and send the email.
Then use the xml parser component (available on most servers by default XP Pro,2000,2003 at least) to do a http post to the other server repopulating all your form data. You basically dynamically build a suitable questring (the example below is hardcoded) and then it actually passes each value as individual form elements. DataToSend = "id=1@name=pete@color=red" dim xmlhttp set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP") xmlhttp.Open "POST","http://localhost/Receiver.asp",false xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" xmlhttp.send DataToSend Set xmlhttp = nothing Here is a page with a olot of good information on using this object. http://www.perfectxml.com/MSXMLHTTP.asp Show quote "Goldwind" <Goldw***@discussions.microsoft.com> wrote in message news:6B5A2669-391F-4AA5-90D3-F7935B3657C9@microsoft.com... > Hi, > > I"m writing a page in asp. When the user presses on Submit the form is > passed by Post to a url in a different site. > The problem is that i want to do this action in script, meaning call a > function which will call the url and pass the form by Post. > > There are : > Server.Transfer - passes only to a page in the same site, so no good for > me. > Response.Redirect - Doesnt pass and form or query parameters so no good > for > me again :( > > So how will i do this? > > Thanks in advance |
|||||||||||||||||||||||