setting ajax method