The type of the data is always string. I also cannot specify the dataType. If it will be different (HTML instead of JSON) jQuery fails silently.
I made a litle function to check the string if it HTML or JSON. It works so far, but is totally inelegant: this.isJsonStr = function(str) { if (!str || typeof (str) != 'string' || str.length < 2) return false; return str[0] == '{' || str[0] == '['; } Unfortunately I do not see jQuery providing similar function, while Prototype does: http://www.prototypejs.org/api/string/isJSON On Jul 8, 1:12 am, Giovanni Battista Lenoci <gian...@gmail.com> wrote: > dnagir ha scritto:> Anybody please? > > if(typeof(ret_data) == 'object') { > > } > > or if it's not evalueated by jquery try to eval with a try/catch block. > > :-)