admin管理员组文章数量:1295845
I have ajax search based web (filter with inputs and results) where i want make working back/foward browser button. So i must use window.history.pushState
witch is working with contetnt (search results) but i must 'store' whole filter with inputs and selected values.
On filter inputs i am using SumoSelect plugin and if you store all html elements to variable and after that append it back to DOM (after press back button) functionality of SumoSelect is not working any more...
Here is my question about it. One possible solution (what i know) how make it works after append is use .contents()
instead of .html()
.
BUT if i use .contents()
in pushState
like this:
window.history.pushState({"html":results,"filter": $('#filter').contents(),"pageTitle":"title"},"", null);
I get error:
DataCloneError: The object could not be cloned.
So is there any options how store filter to state to make it work?
I have ajax search based web (filter with inputs and results) where i want make working back/foward browser button. So i must use window.history.pushState
witch is working with contetnt (search results) but i must 'store' whole filter with inputs and selected values.
On filter inputs i am using SumoSelect plugin and if you store all html elements to variable and after that append it back to DOM (after press back button) functionality of SumoSelect is not working any more...
Here is my question about it. One possible solution (what i know) how make it works after append is use .contents()
instead of .html()
.
BUT if i use .contents()
in pushState
like this:
window.history.pushState({"html":results,"filter": $('#filter').contents(),"pageTitle":"title"},"", null);
I get error:
DataCloneError: The object could not be cloned.
So is there any options how store filter to state to make it work?
Share asked Jun 6, 2017 at 9:46 Lajdák MarekLajdák Marek 3,0898 gold badges32 silver badges60 bronze badges1 Answer
Reset to default 9The pushState location state object must be serializable, which means no methods. $('#filter').contents() returns a jQuery object that can't be serialized.
Try turning the contents into an object or array.
本文标签: javascriptDataCloneError The object could not be clonedStack Overflow
版权声明:本文标题:javascript - DataCloneError: The object could not be cloned - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741615712a2388514.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论