简体   繁体   English

Javascript源无法加载。

[英]Javascript source won't load.. kind of

I am completely stumped on this one. 我完全被这个困扰。 COMPLETELY stumped. 完全陷入困境。

I'm building the framework for an ad network. 我正在建立广告网络的框架。 While prototyping, I did most my building at Kodingen. 在进行原型制作时,我在Kodingen进行了大部分建筑。 Everything worked fine over there. 那里一切正常。 I just migrated to a new host, though, and I've got this one weird problem. 不过,我只是迁移到了新主机,却遇到了一个奇怪的问题。 Weird. 奇怪的。

Bear with me as I explain this. 在我解释这一点时,请多多包涵。

The ads for my ad network are placed through a code snippet that the user places on his site. 我的广告网络中的广告是通过用户放置在其网站上的代码段放置的。 Here's the code snippet: 这是代码片段:

<script type="text/javascript">
document.write('<scr' + 'ipt type="text/javascript" src="http://mysite.net/ad_engine.php?pid=333"></scr' + 'ipt>');
  </script>

And, after PHP processes the request, here's the output on the ad_engine.php page: 而且,在PHP处理了请求之后,这是ad_engine.php页面上的输出:

document.write("<div class='adframe' style='min-width:250px; min-height:100px;'><a href='click.php?adid=4224&pid=333' target='_self''><img src='http://mysite.net/ads/image.png' border='0' class='adimage' style='min-width:125px; min-height:100px;' /></a><span class='adtext'><a href='click.php?adid=4224&pid=333' target='_self''>This is the ad contents right here</a></span></div>");

This method worked fine when I was developing on Kodingen. 当我在Kodingen上进行开发时,此方法效果很好。 The ad appeared on any page I placed this snippet on. 广告出现在我放置此代码段的任何页面上。 But, since having migrated to my new server - and not having changed anything - this method won't work. 但是,由于已迁移到我的新服务器-且未进行任何更改-此方法将不起作用。

ON THE NEW SERVER: ad_engine.php, when typed directly into the address bar, shows the ad like usual. 在新服务器上:ad_engine.php直接在地址栏中输入时,会像往常一样显示广告。 But when it's loaded onto any other page via that first code snippet I showed you, the ad won't appear. 但是,当通过我向您展示的第一个代码片段将其加载到任何其他页面时,该广告将不会显示。 Strangely enough, the OLD ad_engine.php file - the one on my old host - still works fine even if I load it onto a page on my new host. 奇怪的是,即使我将旧广告ad_engine.php文件加载到新主机上的页面上,它也可以正常工作。 Follow? 跟随?

Although no ad appears, I know that the ad_engine.php page, the one on my new host, I know that it IS being processed, because MySQL changes are made like they're supposed to. 尽管没有广告出现,但我知道ad_engine.php页(位于我的新主机上的那一页)知道正在处理,因为MySQL的更改应按预期进行。

I've tried to be as clear as I can in explaining this problem, if you've got any questions just let me know. 如果您有任何疑问,请让我知道。

Help? 救命?

Already tested a caching problem? 已经测试了缓存问题? Maybe your new host has different cache settings? 也许您的新主机具有不同的缓存设置?

Try adding some random number to the .php call: 尝试在.php调用中添加一些随机数:

document.write('<scr' + 'ipt type="text/javascript" src="http://mysite.net/ad_engine.php?pid=333&x=RANDOM_NUMBER_GOES_HERE"></scr' + 'ipt>');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM