2014年6月2日 星期一

Cannot read property 'createDocumentFragment' of null

處理分頁時,使用ajax去重新讀取資料並且load頁面

經過了種種javascript傳遞物件失敗的挫折後,終於成功

因為太懶惰,所以想直接$(document).html(result)

結果卻一直失敗

本來以為是之前發現過的viewstate問題

沒想到問題更淺

竟然只是js的問題

stackoverflow上面是這樣說的

It doesn't make sense to try to add an element to the start of the document object. It isn't an HTMLElementNode. As far as I know, you can't give it additional children at all.
If you want to add a div element to the start of something, then the highest node that is allowed to contain it is the body element, so use:
$(document.body).prepend
… instead.


參考資料:http://stackoverflow.com/questions/16785227/jquery-prepend-cannot-call-method-createdocumentfragment-of-null

沒有留言:

張貼留言