I have an associative array after json_encode like this
{"1":"CourseA", "2":"CourseB"}
and it is stored in a php variable named $jsonObject.Now, I want to send this to a javascript function and use that array inside that function. The function is invoked onclick like this:
<a href="#" onclick="popup('.$jsonObject.');">link</a>
The problem is: It shows an error:invalid id popup({....
Whats the reason and what should be the solution for that? btw, I am working in moodle and the above link is shown inside a moodle block and declared inside $this->content->text.