How do I send data from Parent Id to server-side script then use where condition?
How do I send data from Parent Id to server-side script then use where condition?
jojome
Posts: 3Questions: 1Answers: 0
var rowData = row.data();
var table = $('<table id="table" class="display" width="100%"/>');
row.child(table).show();
var usersEditor = new $.fn.dataTable.Editor({
ajax: {
url: "php/table.rpt2.php",
type:"POST",
data: function(d) {
d.pinno = rowData.id;
}
},
table: table,
fields: [
{
label: "OWNERNAME",
name: "ownername"
},
{
label: "TDNO",
name: "tdno"
},
{
label: "PINNO",
name: "pinno",
def: rowData.id
}
]
}); ```
This is the code that I have been using. I tried using ->where('pinno',$_POST) at the server-side script but so far I can't make it work.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
$_POST is wrong. It should be $_POST["pinno"].
If you want me to take a look post your server side code please.
Also: I can't see what row.data() really is. Is it the data of one single row?
Here is an example with a parent and a a child table that works:
Server side:
@rf1234 thank you for your response. Yes row.data is the data of a single row. I verified that the
has the correct value using the
as it will give the value of whatever row it belongs to whenever I create new entries.
I am trying to send that value from ajax to server-side script using
Here is my Server-Side Script using the code you have given
I received a warning "table id = table - Invalid JSON response". I did try another approach as I remove the if()else() statements then use a sample data '1'
to check if the code would give me a result.
thanks for the help @rf1234 ! Anyway I already solved the problem , with the example you have given I was able to understand the general gist on how to pass the value to server-side. Aside from that, I changed my script to this...
I removed the if statement completely and it works fine now!