Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

tree - ajax problem


Reply


1294 Views

Avatar
trabik

1 Post

10 September 2007 at 12:58am

Hi, can anybody help me with my problem please? On my site I used tree javascript utility to generate tree list of items. But there are many items so I need load them from DB with ajax. But if i do this (load some data and then build new list <ul id='tree'>..... ) this script doesn't work.. Maybe it must be refreshed after rebuild ul with JS DOM operations?? But how can I do it? If I generate <ul> with JS and not after ajax it works. Thanks a lot!
this is sample code:
function handle(xhr, json) // ajax handle function
{
var tree = document.getElementById('treediv'); // this three lines don't work here
tree.innerHTML = "<ul class='tree'>....   "; // (tree is generated but no 'recognized'
appendLoader(autoInit_trees); // => there are not +- buttons, folder icons etc..
}

function getData(par) // make ajax request
{
var myAjax = new Ajax.Request('../getMarques',
{method: 'get', parameters: { ... },
onComplete: handle});
// but if I put them (=three lines) here it's ok .... but I must use ajax to load data, how? :(((
}