Fixed ajax functionality