JQuery Validate & Loading Tracking Image

JQuery Validate & Loading Tracking Image

Closed - This job posting has been filled and work has been completed.

Job Description

I have a JQuery validate event on my form.

rules: {
firstname: "required",
lastname: "required",
email: {
required: true,
email: true
cellphone: {
required: true,
phoneUS: true
messages: {
firstname: "Please specify your first name",
lastname: "Please specify your last name",
email: {
required: "Please enter your email address",
email: "Your email address must be in the format of [email protected]";


This works fine.

However if the form successfully validates, I want to run the following code:

var img = document.createElement("img");
var goalId = 123456;
var randomNum = new Date().getMilliseconds();
var value = 100;
var label = "label";
var url = encodeURI(location.href);

var trackUrl = "http://www.googleadservices.com/pagead/conversion/"+goalId+"/?random="+randomNum+"&value="+value+"&label="+label+"&guid=ON&script=0&url="+url;
img.src = trackUrl;

and I can't get it to work!! It is critical that the image loads fully before the form is actually submitted as well.

Please help.