add support for jquery callback method

jQuery sometimes provides a callback method, with may be not fully supported by php json_encode method.