jQuery使用ajax加载URL [英] Jquery load url with ajax
问题描述
我正在尝试使用.load()
函数完全加载页面时自动运行ajax url.看来我的代码行不通.
I'm trying to automatically run an ajax url when my page is fully loaded using .load()
function. It seems my code doesn't work.
其他信息:
-
该代码用于跟踪会员用户,并在网站上为商家用户提供
The code is used for tracking affiliate users and is provided on the website for merchant users
我不确定jquery
版本,但我知道我的版本不接受$
,但仅接受jQuery
I'm not sure of the jquery
version but I know my version doesn't accept $
, but only jQuery
代码:
$(window).load(function() {
$.ajax({
url: "https://shareasale.com/sale.cfm?amount=99.00&tracking=15&transtype=sale&merchantID=xxxxx"
});
});
我错过了什么吗?预先感谢.
Did I miss something? Thanks in advance.
推荐答案
我真的很困惑,为什么需要通过Ajax加载跟踪像素:
I am really puzzled why you need to load a tracking pixel via Ajax:
我以前在SEO工作,我们只将指向跟踪像素的链接包含在图像中,例如通过
I used to work in SEO and we would just include the link to the tracking pixel in an image e.g. via
<img src="https://shareasale.com/sale.cfm?amount=99.00&tracking=15&transtype=sale&merchantID=49748" width="1" height="1">
.
那么您就没有跨域问题,没有ajax,也没有后顾之忧,它只是在他们的网站上记录所加载的页面包含您的会员代码(并且可能会同时丢弃一个cookie).
Then you have no cross domain issues, no ajax, no worries.It just records on their site that the page loaded has your affiliate code (and probably drops a cookie at the same time).
这篇关于jQuery使用ajax加载URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!