Jump to content

Json Objects In Input Values


johnnyg24

Recommended Posts

EDIT: I just need to use the eval() function. I am building a custom report where users can choose which information is displayed in a table. All of the data is in json format. I would like to be able to store the object reference in a input value. For example:

<input type="checkbox" class="ops" value="json.c[i].name">Customers Name<input type="checkbox" class="ops"  value="json.c[i].address">Customer Address<input type="checkbox" class="ops"  value="json.c[i].sales">Customer Sales <input type="button" value="Generate Report" onClick="genRep()"> function genRep(){  $(".ops:checked").each(function(){	for(i=0;i<json.c.length;i++){	  str += "<td>" + $(this).val() + "</td>"	}  }  //then i would append str to a table}

The function genRep() is just to show what I am trying to accomplish by storing 'json.c.name' in an input value, not necessarily how the table would be laid out. Storing 'json.c.name' as a value is preventing the function to work and I know my json is formatted properly. Is there are way to do something similar to what I'm trying to accomplish above?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...