PDA

View Full Version : Quick and simple javascript question



daxtrajero
05-06-2011, 11:13 AM
Please forgive my ignorance for posting this, but need to get something straight in my head.

I have a web page 'form.html', whose job it is to take user input and submit the data to my other page, 'process_form.html'

With me so far? Right, so 'process_form.html' runs some google analytics ecommerce script and sends the results off to google analytics.

Now, my question is, what if 'form.html' sits on a different server, different website, elsewhere on the internet. What if that server didn't have javascript enabled (its belongs to payment gateway company called Worldpay)

So in this case, they send the result of 'form.html' to my page 'process_form.html' - will it still be able to run the page, including javascript correctly ?

I'm not sure whether its my server or their server that is processing the javascript part of 'process_form.html'

Again, excuse my ignorance.

Dax

jscheuer1
05-06-2011, 03:04 PM
Since both pages involved are .html pages I don't think it can work. That implies that there's no server side GET or POST data being sent from form.html, or if there is, it's being gathered from form.html via javascript and sent as a pseudo GET. More likely it's sent as a javascript cookie, or where available as javascript local storage. Both of these are generally domain specific and in any case require javascript.

Is there any javascript and/or are there any external javascript tags on form.html? If so and these are required, it will not work.

There's probably a forum or a Google Groups on this very process, you could probably get a more definitive answer there.

But, as I say, it probably won't work.

daxtrajero
05-06-2011, 03:41 PM
John, thank you.

I should correct myself - the page which processes the form inputs (on my server) is

"process_form.cfm"

would that make any difference?

djr33
05-06-2011, 05:07 PM
CFM stands for cold fusion markup language, and it is a serverside programming language like PHP or CGI. This can support form data. You don't need to use Javascript.

jscheuer1
05-06-2011, 05:36 PM
You don't need to use Javascript.

Well yes and no. The Google script requires javascript, so you need javascript for that, and if that all happens on your server, that's covered. And if the page on the other server is a true HTML form with no essential javascript associated with it and it POSTS or GETS to the page on your server, then it really can work. In fact, there should be no reason why not.

In other words, if on form.html there's just a form whose action attribute is set to process_form.cfm on your domain, and as I say there is no essential javascript on form.html, it will most likely work. The form.html page should have something like this on it:


<form action="http://www.yourdomain.com/process_form.cfm"

If it does, and if that's all it relies upon for submitting the information to process_form.cfm, then it should work.

djr33
05-06-2011, 05:40 PM
Correct. I meant that Javascript is not central to processing the form, though it can be submitted or generated in any way you'd like, including Javascript.