2

I am starting with jqtree and I need to load data from server, without url (I have seen examples of loading ajax data from url, and it's not what I need) and I haven't found anything about that anywhere. Does someone know how can I set a jqtree treeview calling the data from the server? Also, how should I return the json node list?

maugusto
  • 74
  • 6

1 Answers1

1

A server request needs a URL. That's how HTTP works.

An alternative you can try is to put the data directly into the page which initializes the jqtree. The data attribute can directly be given a JS object.

Stefan Majewsky
  • 5,427
  • 2
  • 28
  • 51
  • That's what I am trying to do, but first I must convert the data to JSON in .NET and then throw it to jquery to catch it. Now my question is: how can I call an ajax function from jqtree and get a JSON list to set the treeview? – maugusto Dec 18 '12 at 11:55
  • So you're generating the HTML page which will contain the jqtree in .NET? Then surely you can use some .NET library to generate a JSON string, and embed that into your generated page. – Stefan Majewsky Dec 18 '12 at 12:54
  • 2
    Here's the code I got from right here, stackoverflow, to format the string into the JSON data jqtree expects. – maugusto Dec 19 '12 at 16:41