Made post api more flexible in xhr.js