javascript - What is the difference between $("...").html() and $("...").load()
PHPz
PHPz 2017-05-19 10:27:47
0
1
552

$.ajax({

    url:url,                                                  $(dlgId).load(url);
    type:'post',                                              $(dlgId).dialog('open');
    dataType:'html',
    error:function(){
        $.boxUtil.alert("请求异常");
    },
    success:function(data){    
            $(dlgId).html(data);
            $(dlgId).dialog('open');
    }

});
data returns a page. Loading $("...").width() in HTML will report an error.
The url is the request address, and the return is also a page. In the load loading page, the $("...").width() method works just fine, I don't know why

PHPz
PHPz

学习是最好的投资!

reply all(1)
左手右手慢动作

This is written in the document, jQuery.ajax()里你用dataType: "html"返回的是html纯文本,而用.load()The returned html will be directly inserted into the node wrapped with $. Also, you spelled width wrong. . .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template