Im kind a new to jaggery(http://jaggeryjs.org/) and I'm implementing a sample site using this technology. I have the following file in my file directory
employees.json (note: ignore the validation of the data)
{
"employees": [
{
"id": "1",
"name": "2",
"age": "3",
"town": "4",
"salary": "5"
},
{
"id": "3",
"name": "fd jf",
"age": "dfkd jf",
"town": " jdks fj",
"salary": " fjkdf "
},
{
"id": "1",
"name": "2",
"age": "3",
"town": "4",
"salary": "5"
}
]
}
I displayed this data using html table below and i included function to delete the json element within that row itself.
index.jag(note: this is a part of that code)
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<%
var json = require("employees.json");
%>
</head>
<body>
<h1>Employee Details</h1>
<%
include ("new_employee.jag");
%>
<h2>List all Employees</h2>
<table "employeesTable" border="2">
<tr>
<th>Emplyee ID</th>
<th>Name</th>
<th>Age</th>
<th>Town</th>
<th>Salary</th>
</tr>
<%
for (var i in json.employees){
%>
<tr>
<td><%=json.employees[i].id%></td>
<td><%=json.employees[i].name%></td>
<td><%=json.employees[i].age%></td>
<td><%=json.employees[i].town%></td>
<td><%=json.employees[i].salary%></td>
<td><%delete employees[i]%></td>
</tr>
<%
}
%>
</table>
as you can see my delete function is wrong because i could find any resource document that guid me to delete json element i.
Can some help me to delete this json element using Jaggery.
If you want to do what harsha89 has mentioned, you could make an ajax call to jag script on the server and do the deletion and update the table asynchronously with callback function(assuming the table is getting populated from server side source) if you need to just remove table element on client side JQuery would be easy.