简体   繁体   English

XmlHttpRequest在移动浏览器上不起作用

[英]XmlHttpRequest not working on Mobile Browser

function ajaxify()
    {
     alert('stuff');
     xmlHttp = new XMLHttpRequest();
     xmlHttp.open('GET', 'page.php?params=' + params, true);
     xmlHttp.onreadystatechange = callbackFunction;
     xmlHttp.send();

    }

function callbackFunction(){
alert('called');
}

Never alerts "called", but does alert "stuff". 从不警报“被呼叫”,但警报“东西”。 Testing on iPhone 4.2.1 and Windows 7 Phone. 在iPhone 4.2.1和Windows 7 Phone上进行测试。 Doesn't work on either. 两者都不起作用。 I'm told it works on newer phones. 有人告诉我它可以在较新的手机上使用。 Works on desktop browser. 在桌面浏览器上工作。 The page is loaded, but the callbackFunction is never called. 该页面已加载,但从未调用callbackFunction。 Any way of fixing this? 有什么办法解决吗?

EDIT: Note, I also tried xmlHttp.onload , seems like the same issue. 编辑:注意,我也尝试了xmlHttp.onload ,似乎是同样的问题。

You have a syntax error. 您有语法错误。 forgot ' after params= : params=之后忘记了'

xmlHttp.open( 'GET', 'page.php?params="' + params, true)

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

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