ajax working, resolving db issue