I am populating a JSONObject from backend java and setting it to variable in jsp.
I need to pass the variable to JavaScript function during onchange event.
I am getting syntax error during onchange due to quotes present in the JSONObject.
If I populate as a Map in backend java and I can able to set it to a variable in jsp and pass to JavaScript function successfully.
My question?
- Shall we pass the JSONObject in onchange event as mentioned above. If yes what could be the syntax.
I used onchange="getCountries('${countryJSON}')" which is not working.
-
If we escape the quotes in JSONObject, is it possible to parse the JSONObject in JavaScript function.
-
Any alternative approach for this issue.
Regards, Selvendran
Aucun commentaire:
Enregistrer un commentaire