django-dajax
django-dajax copied to clipboard
don't use eval in this way
It calls eval on a string containing a variable name; when the minification happens and the variable is renamed, the result is a runtime error.
Your change results in the following error message:
Uncaught TypeError: Property '$("#id_date").val' of object [object global] is not a function
The json received from the server:
[{"fun": "$(\"#id_date\").val", "cmd": "data", "val": "2014-04-08"}]
I've reverted this change in my fork.
I hear ya. Perhaps there should be something along the lines of [{"cmd": "method", "elem": "#id_date", fun: "val", "val": "2014-04-08"}], but that's not for me to say. In any case, you could just use [{"cmd": "js", "val": "$("#id_date").val("2014-04-08")"}], although I agree it's not as nice.