Error in loadAjax() when using $.afui.loadContent()
nsundberg opened this issue ยท 13 comments
I am trying to use $.afui.loadContent() to load an external html file, as per the documentation, but getting the following error:
Uncaught TypeError: Cannot read property 'getAttribute' of undefined
The reason is src/af.ui.js:834:
var forceRefresh=anchor.getAttribute("data-refresh");
When using $.afui.loadContent() anchor
is never set.
The documentation also states that you can persist panels by using:
//you must set every parameter, with the last being "true" so it knows to perist the div
$.afui.loadAjax("content.html",false,false,"slide",true)
Which of course also results in the same error since anchor
is not a DOM object.
I m facing the same issue. It seems that this fix is not merged yet. Are there any suggestions here?
Thanks in advance.
So, my understanding here is that anchor
parameter in loadContent
is mandatory when target
is not an HTML id. Isn 't that right?
Do you know @holmberd if that is based on a decision or is about a misplaced commit that will be fixed in a later version?
Thanks
I'll be honest, I haven't looked at this code in over a year. If someone wants to submit a PR to fix this, I'll merge it. Otherwise it will stay in this state.
@holmberd it was most likely reverted by accident (me not pulling down and doing a push). That fix you outlined should be there. If you want to open a PR bringing it back, I will merge it!