views:

352

answers:

1

Hello,

I have realized a asynchronous treeview in php, now i want to add onclick event to the items in the treeview, and then make query in mysql.

Do you know how to do that?

Thanks a lot.

Edit:

Async.html:

<script type="text/javascript">
$(document).ready(function(){
    $("#black").treeview({
        url: "twodimen.php"
    });
    $("#black > li").live("click",function()){
        $.get("");
    })
});
</script>

<ul id="black">
</ul>

But when i add the $("#black > li").live("click", function()){}, the treeview doesn't display.

How to do that?

+1  A: 

Well, this would be a start:

$("#treeview > li").click(function() { // this sets the onclick on your node
    $.get('url_to_php_script_that_will_the_db'); // this calls an url using GET.
    $.post('url_to_php_script_that_will_the_db'); // this calls an url using POST.
}

Suppose your treeview has id 'treeview', all the <li> under the treeview will have a click event. It's a rough start, but that's basically what you're looking for.

Mademoiselle Vagin Cul
@Racebacon, please see my edit. I've changed my code, but i don't know how to do the following things.
garcon1986
Can you post your entire treeview code? From what I see, it's probably the 'ul > li' selector that conflicts, but i'd need more insight.
Mademoiselle Vagin Cul