I want to access information from same domain but with different port number, To allow this I am adding Access-Control-Allow-Origin with the response header.
You are missing 'json' dataType in the $.post() method:
$.post('http://www.example.com:PORT_NUMBER/MYSERVLET',{MyParam: 'value'})
.done(function(data){
alert(data);
}, "json");
//-^^^^^^-------here
Updates:
try with this:
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));