在使用$.get()方法时,出现了以上的错误信息:
HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy
下面是我的源代码:
$(document).ready(function() { var pageNum = 1; $('#more-photos').click(function() { var $link = $(this); var url = $link.attr('href'); if (url) { $.get(url, function(data) { $('#gallery').append(data); }); pageNum++; if (pageNum < 20) { $link.attr('href', 'pages/' + pageNum + '.html'); } else { $link.remove(); } } return false; }); });
其中,出现错误的就在:
$.get(url, function(data) { $('#gallery').append(data); });
因为,我请求的是一个html的页面片段,将得到的html片段加载在index页面中,而jQuery.get()方法中漏写了dataType。
在jQuery中的官网中,datatype默认为:智能匹配。即,由电脑智能猜测你的datatype是什么类型的,很显然,本次没有猜对。
【解决方法】:很简单,将datatype写上。
$.get(url, function(data) { $('#gallery').append(data); },'html');
相关推荐
- FIX: After deleting the selected points in the TFlexPanel.DeleteSelectedPoints the all figures with one point also deleted. - FIX: When the curve contain more then one figure and they were all ...
In our example, if one transaction (T1) holds an exclusive lock at the table level, and another transaction (T2) holds an exclusive lock at the row level, each of the transactions believe they have ...
On a qualified select, update, or delete, the correct leaf page will be the lowest page of the tree in which one or more rows with the specified key or keys reside. A qualified operation is one that ...
Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes ...
Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes ...
Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes...
Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes ...
Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes...
Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes ...
Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes ...
ResourceTemplate, but cannot be disassembled as such because the EndTag does not appear at the very end of the buffer. AcpiExec - Added the "-t" command line option to enable the serialized mode of ...