Optimize the code for asynchronous request

. Add ajaxSuccess function to deal with the success
. Add ajaxError function to deal with the error

Signed-off-by: jssoscar