Currently working on incorporating Facebook conversion tracking into a Facebook Tab. To see the page, visit this link. The issue I'm facing is that a separate page does not load after the form has been submitted. Is there a way to execute a section of JavaScript only when the submit button is clicked? It seems like it needs to be injected into the head of the HTML document. I came across a solution for running JavaScript from a link or click - would this approach work if I trigger the tracking/conversion code from a different JavaScript file?
Any assistance on this matter would be highly appreciated. Thank you!
"I agree with the previous comments stating that calling a file directly might not work, but loading a JS file could be achieved as shown below. Although unsure if this directly addresses your concern, it might provide some guidance... and in my example, I've used a link instead of a button...
<a href='linkhref.html' id='mylink'>click me</a>
<script type="text/javascript">
var myLink = document.getElementById('mylink');
myLink.onclick = function(){
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "Public/Scripts/filename.js.";
document.getElementsByTagName("head")[0].appendChild(script);
return false;
}
</script>"