Simplified cross domain check a little by using jQuery.

It seems to make sense to me to use jQuery to check for whether or not the request is cross-domain since jQuery already does this for us.