I am creating a dynamic query string for SOQL. Currently it is working fine as I am using database.query().
For example : string soqlStr = 'select Id, Name From Account where Name = \'Test\'';
database.query(soqlStr);
But, I want to use the same string in java script to call sforce.connection.query();
But, it seems the Javascript is not accepting the soqlStr format, because of where Name = \'Test\''.
We can use document.getElementById() in javascript, but our search page has multiple filter criteria.
is there any other solution where we can use the same soql string for both class and Javascript.
{!JSENCODE(soqlStr)}