I am using PHP to generate a dynamic web form that uses an external (to my site) javascript file to set a hidden form input value. My form submits to my own PHP page before reposting to an external site. The external site requires this hidden value for any submission.
Many of the browser that are using my form do not have javascript enabled, so the tracking fails and I can not submit to the external site. Is there any method of executing the javascript file to get the tracking information from my php code without sending it to the clients browser?
This is a pseudo code mock up of the code that I want to handle the form's post:
if ($doPOST) {
//Check POSTed parameters for tracking id ($tid)
if ($tid == ''){
//Execute external javascript to get tid
}
//Post form data to external site
}
I have looked around and could not find any relevant information, but if you know of a site where this is explained let me know. For clarification, I am not looking for information about to incude a javascript file client side.
Edit: This is the Javascript executed by the form. I have no power to change this script. The number 48891 is not hardcoded in the script it changes with execution:
onReady=(function(ie){var d=document;return ie?function(c){var n=d.firstChild,f=function(){try{c(n.doScroll('left'))}catch(e){setTimeout(f,10)}};f()}:/webkit|safari|khtml/i.test(navigator.userAgent)?function(c){var f=function(){/loaded|complete/.test(d.readyState)?c():setTimeout(f,10)};f()}:function(c){d.addEventListener("DOMContentLoaded",c,false)}})(/*@cc_on 1@*/);
var test_track=function(data){onReady(function(){document.getElementById('test_track').value = data.TID})}
test_track({"TID" : "488891"});