Thursday, July 5, 2012

Solution for issues in IE on using jQuery Ajax

Internet explorer has issues with jquery ajax. For getJASON method, the result obtained in the callback function will be null, in IE (Internet explorer) .

To solve this, the following code to be added, before returning from ajax method

       
        response.setContentType("application/Json");
        response.addHeader("Pragma", "no-cache");
        response.addHeader("Cache-Control", "no-cache"); // HTTP/1.1
        response.addHeader("Cache-Control", "no-store"); // HTTP/1.1
        response.addHeader("Cache-Control", "must-revalidate"); // HTTP/1.1
        response.setContentType("application/x-json;charset=UTF-8");



This can be used for solving issues with IE on using DataTable also.