Javascript适用于测试服务器,但在实时服务器上出错

时间:2014-05-05 22:16:50

标签: javascript twitter-bootstrap contact

我有一个网站,我一直在测试服务器上开发完美,但是一旦我将网站启动到另一台服务器上,我就会收到javascript错误,这会阻止我的联系表单验证码工作,从而阻止表单提交。

http://www.acgtax.com/

我尝试对联系表单和任何相关脚本进行故障排除。如果有人能指出我正确的方向来解决问题,我真的很感激。

控制台错误:

JQMIGRATE: Logging is active jquery-migrate-1.2.1.js:21
JQMIGRATE: jQuery.attrFn is deprecated jquery-migrate-1.2.1.js:41
console.trace() jquery-migrate-1.2.1.js:43
migrateWarn jquery-migrate-1.2.1.js:43
JQMIGRATE: jQuery.fn.live() is deprecated jquery-migrate-1.2.1.js:41
console.trace() jquery-migrate-1.2.1.js:43
migrateWarn jquery-migrate-1.2.1.js:43
JQMIGRATE: jQuery.fn.attr('selected') may use property instead of attribute jquery-migrate-1.2.1.js:41
console.trace() jquery-migrate-1.2.1.js:43
migrateWarn jquery-migrate-1.2.1.js:43
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
carouFredSel: No element found for "#foo2". 

1 个答案:

答案 0 :(得分:2)

错误似乎在您的php验证码脚本中。在开发工具中检查XHR请求时,您可以看到math-captcha.php返回

Fatal error: Call to undefined function: json_encode() in /home/acgtax3/public_html/lib/math-captcha.php on line 8

当您再次检查响应头时,您可以看到在您的实时服务器上运行php 4.4.9,而您在测试服务器上运行php 5.4.17。 json_encode已添加到php 5.2 as you can see here中,因此我怀疑您应该将实时服务器上的php版本增加到至少5.2以解决问题。理想情况下,测试服务器和实时服务器的版本应该相同,以防止在部署时出现类似的错误。