English 中文(简体)
页: 1 学历
原标题:jQuery check status
  • 时间:2010-06-17 09:59:25
  •  标签:
  • jquery
  • ajax

这一职能每次都有“false”,即使image_url。 存在

// some .each {
    var item = $( .item , this);
    $.ajax({
        url: image_url,
        success: function() {
            item.html("true");
        },
        error: function() {
            item.html("false");
        }
    });
// }

用于核对<代码>image_url文档的现存情况——这一变量提供的是<代码>的url, http://blog.com/teddybear.png。

任何想法?

最佳回答

由于same-origin policy,这妨碍了从另一个领域收集任何数据。

然而,希望! 页: 1 <代码><img> 元件,以了解是否存在,如:

function testImage(url) {
    $("<img />", { 
      error: function() { item.html( false ); }, 
      load: function() { item.html( true ); }
    })​​.attr( src , url);
}

你们可以在这里看到一个快速的“,它检测到一个有does的图像,然后等待2秒钟,然后试看一看。 使用了为创建<img>要素,安排活动,然后制定/code>,我们只是对哪些活动作为通行证/fail检查而打。

问题回答

暂无回答




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...