jquery .load()函数在phonegap下不工作 [英] jquery .load() function does not work under phonegap

查看:186
本文介绍了jquery .load()函数在phonegap下不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jquery .load()函数不能在iPad上的phonegap下工作。它在移动safari非常好。但它不工作在Phonegap应用程序。



更新:这是代码的样子:

  this.image_container.load(function(response,status,xhr){
var dis = this;
var imgWidth = dis.image_container.width();
var imgHeight = anum({opacity:1); b。 },400,linear);
});

调试服务器响应时

  {responseText:,status:404,statusText:error} 

但我只有在iPad phonegap这个。






它仍然不工作。这里是代码片段:

  this.image_container.load(function(response,status,xhr){
var dis = this;
var imgWidth = dis.image_container.width();
var imgHeight = dis.image_container.height();
dis.containerEl.css({
//一些css添加
})。animate({opacity:1},400,linear);
}

调试服务器响应时

  {responseText:,status:404,statusText:error} 

但我只有在iPad phonegap这个。

解决方案



尝试使用完整的网址。



AFAIK PhoneGap实际上作为本地文件。如果您要访问外部资产或Ajax,请在网址中包含协议,域和端口(如有必要)。


jquery .load() function is not working under phonegap on iPad. it works in mobile safari very well. But it's not working in Phonegap app. Any help would be appreciated.

UPDATE: Here is what the code looks like:

this.image_container.load( function(response, status, xhr) {
    var dis = this;
    var imgWidth = dis.image_container.width();
    var imgHeight = dis.image_container.height();

    dis.containerEl.css({
        //some css addition
    }).animate( { "opacity": "1" }, 400, "linear" );
});

While debugging server response is

{"responseText":"","status":404,"statusText":"error"}

But I only get this in iPad phonegap. In mobile safari it just works fine.

Thanks in advance.


It still is not working. Here is code snippet:

this.image_container.load( function(response, status, xhr) {
  var dis = this;
  var imgWidth = dis.image_container.width();
  var imgHeight = dis.image_container.height();
  dis.containerEl.css({
    //some css addition
  }).animate( { "opacity": "1" }, 400, "linear" );
});

While debugging server response is

{"responseText":"","status":404,"statusText":"error"}

But I only get this in iPad phonegap. In mobile safari it just works fine.

Thanks in advance.

解决方案

Try using a full URL.

AFAIK PhoneGap is actually served as local files. If you want to access external assets or Ajax, then include the protocol, domain and port (if necessary) in the URL.

这篇关于jquery .load()函数在phonegap下不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆