Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,
I have been fighting with my first application which uses JQuery (jsTree) and Json.
I thought everything was going great I was able to get the data from SQL server convert to Json but now all the data just fills the page and is not in a Treeview.
please let me know drop a solution for me.
instead of that i got the below error,

JavaScript
JavaScript runtime error: Syntax error, unrecognized expression: [{"caption":"&Master"},{"caption":"&Sales"}] // this is for json data


My code is :


HTML
<script type="text/javascript">
						$(function () 
						{
						  
							$('#jstree2').jstree({'plugins':["defaults","checkbox"], 'core' : 
							{
							"themes":{
							"responsive":true
							},
							 "data": {
							  type: "POST",
                              url: "Default.aspx",
                              contentType: "application/json; charset=utf-8",
                              datatype:"json",
						      success: function (data) {
                                       data.d;
                                       $(data).each(function () {
                                           return { "id": this.id };
                                          });
                                         }
                                         }
							}
							}
							);
						});
						</script>



HTML
<div id="jstree2" style="margin-top:2em;">

      </div>



thanks in advance.

What I have tried:

Not binding to jsTree using jquery?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900