Hello,
I am trying to hookup the basic example http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxtree/index.htm?%28bootstrap%29#demos/jqxtree/ajaxloading.htm to a mvc json data request….it is failing miserably. May be my fault I may be missing something here is my code you let me know if you can.
I have a model:
public class reportTypes { public virtual int value { get; set; } public virtual string label { get; set; } public virtual int id { get; set; } public virtual int parentid { get; set; } }
That is gets filled by a stored procedure.
I make this call in my js file.
var theme = "bootstrap"; // Create jqxTree var tree = $('#jqxTree'); var source = null; $.ajax({ async: false, type: "POST", url: "/DataService/GetAllReportTypes", success: function (data, status, xhr) { source = jQuery.parseJSON(data); }, error: function () { alert('Error in Data Retrieval'); } });
and source always comes back null. if I debug this my model is getting filled and returned just fine, in fact from fiddler the json being returned is {} id=1 label=System parentid=1 value=1
what appears to be the issue is in the success portion of this call the jQuery.parseJSON(data) is not doing anything…is this the standard call? Or am I just making a silly mistake. Any help would be appreciated.