we use below script to display results for both types : admin and 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 the "Designer" column only for type = admin , so we are trying to display the javascript result with the 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 display as below. this code is the reason for displaying below the image echo "<script>"; when I used echo "display"; while not displaying anything ....

I am new to coding and I tried a lot before posting the question.