refactor gobal ajax and loading handle.