简体   繁体   中英

How to change the placeholder value for a dynamically fetched text?

I am storing my query in database like below

在此处输入图像描述

While fetching I need to replace the filterId by user inputs.

I tried the below

let filterId = req.body.ids;  // filterId is the placeholder in database
fetchQuery(type, function((responseQuery){
         console.log(responseQuery) // this still printing the placeholder not the user input
       });

Since this is evaluated upon compilation, you should eval() to accomplish this. It would be kind of fun to try.

 var x = 12; var str = 'hello ${x}'; var combined = ( eval ("`" + str + "`") ) console.log(combined)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM