Implementing ajax submit and other ajax functions