JQuery Validate & Loading Tracking Image

Closed - This job posting has been filled and work has been completed.
Web, Mobile & Software Dev Web Development Posted 3 years ago

Fixed Price

Budget: $20
Delivery by January 30, 2013

Start Date

January 30, 2013

Details

I have a JQuery validate event on my form.

            $("#form").validate({
                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 name@domain.com"
                    }
                }
                
            });


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;
document.body.appendChild(img);

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.


About the Client

(5.00) 143 reviews

United States
Kalamazoo 12:47 AM

206 Jobs Posted
77% Hire Rate, 1 Open Job

Over $50,000 Total Spent
175 Hires, 2 Active

$8.20/hr Avg Hourly Rate Paid
5,976 Hours

Member Since Jul 13, 2009