top

Issue when response is null for POST type request on 2012 platform

Published 2014-10-27 | (Compatible with SDK 3.5,4.5,5.0,5.1 and 2012,2013,2014 models)

Troubleshooting null responses from the server on 2012 platform

JavaScript communicates and asynchronously exchanges data with the server using AJAX calls with the server. Usually the request method is GET type. However when the request method is of type POST, and is having a query string attached to it, response is null on 2012 platform.

Solution

Add (if not present)/Change the header with setRequestHeader method. After this change, proper response would be received.

Bad example

this.XHRObj.open("POST", url, true);

Good example

this.XHRObj.open("POST", url, true);
this.XHRObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");