【发布时间】:2013-07-07 21:17:53
【问题描述】:
function ajaxify()
{
alert('stuff');
xmlHttp = new XMLHttpRequest();
xmlHttp.open('GET', 'page.php?params=' + params, true);
xmlHttp.onreadystatechange = callbackFunction;
xmlHttp.send();
}
function callbackFunction(){
alert('called');
}
从不提醒“被叫”,但会提醒“东西”。在 iPhone 4.2.1 和 Windows 7 Phone 上进行测试。也不起作用。我被告知它适用于较新的手机。适用于桌面浏览器。页面已加载,但从未调用 callbackFunction。有什么办法解决这个问题?
编辑:注意,我也试过xmlHttp.onload,似乎是同样的问题。
【问题讨论】:
-
不是一个真正的答案,但有什么特别的原因为什么你不使用抽象层,比如 jquery。它可以解决您必须自行查找和调试的所有问题。
-
我不是特别擅长javascript,我会使用
$('#hidden').load('api.php?params=params', function() { alert('The rest of my code goes here referencing #hidden to get the contents of the file I just loaded?'); });之类的东西 -
我的应用程序也有同样的问题。石冷不工作。
标签: javascript ajax mobile