这样做有什么意义:
var resultsArray = (typeof response.d) == 'string'
? eval('(' + response.d + ')') : response.d;
在$。(ajax)调用的onSuccess()回调中?
答案 0 :(得分:0)
var resultsArray = /* assign a value to resultsArray... */
(typeof response.d) == 'string' ? /* ...if the type of response.d is string */
eval('(' + response.d + ')') : /* ...then evaluate it as if it was JS code */
response.d; /* ...else just assign it unaltered */