How to fetch id form json array and assign it to url of edit.php
How to fetch id form json array and assign it to url of edit.php
bhatt_axay
Posts: 46Questions: 12Answers: 3
Hello,
I am very near to find the solution but how to fetch id from json array and assign it
<a href="edit.php?edt_id="+id>Edit</a>
The code is mentioned below:
columns: [
{ data: "id" },
{ data: "fullname" },
{ data: "user_name" },
{ data: "phnumber" },
{ data: "address"},
{
data: null,
className: "center",
defaultContent: '<a href="edit.php?edt_id="+id class="">Edit</a>
}
]
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Use
columns.render
if you need to assign a dynamic value.Allan
Hello allan
Above answer is right but in my case i'm using the value of returning json array and i want to use it as mentioned in above code.
I'm not sure I understand the problem. Why would you not be able to use
colums.render
to do what you need? It sounds like exactly what you want. Use it as a function. The documentation shows examples of how it can be used like that.Allan
okk I got it.
Thank you so much
Hello,
Still i got the error in columns.render I can't get my id from my json array. Below is my code:
"columnDefs" : [{
"data": "id",
"defaultContent": "<a href=edit.php?id="+{data : id}+">Edit</a>",
"target" : [ 7 ]// can be null or undefined
}]
Okk I got the answer finally.