we are using below script to display results for both types : admin & designer
script
var colsOption = [
{id: 'entity_id' , header: "Order Id" , width :"15",renderer : my_renderId},
{id: 'created_at' , header: "Order Date" , width :"120"},
{id: 'entity_id' , header: "Order Id" , width :"75"},
{id: 'product_id' , header: "Product Id" , width :"70"},
{id: 'designer_id' , header: "Designer" , width :"110"},
];
now we want to display "Designer" column only for type = admin so we are trying to display javascript result with php if condition as mentioned here
php
if ($accountType == "admin"){
echo "<script>";
echo "var colsOption = [
{id: 'entity_id' , header: 'Order Id' , width :'15',renderer : my_renderId},
{id: 'created_at' , header: 'Order Date' , width :'120'},
{id: 'entity_id' , header: 'Order Id' , width :'75'},
{id: 'product_id' , header: 'Product Id' , width :'70'},
{id: 'designer_id' , header: 'Designer' , width :'110'}
];";
echo "</script>";
} else {
echo "<script>";
echo "var colsOption = [
{id: 'entity_id' , header: 'Order Id' , width :'15',renderer : my_renderId},
{id: 'created_at' , header: 'Order Date' , width :'120'},
{id: 'entity_id' , header: 'Order Id' , width :'75'},
{id: 'product_id' , header: 'Product Id' , width :'70'}
];";
echo "</script>";
}
but its displaying like below image. this code is reason for displaying below image echo "<script>";
when i used echo "display";
still its displaying nothing....
I am new to coding & i tried lot before posting question.