updated the ajax method to support all type of requests