Ajax validation

Does anyone has idea how to implement custom rule for validation that waits for ajax response on request that checks e.g. username existance.
If i have something like this:

rules:{
	"username": function(value){		
		var xhrResponse = webix.ajax().sync().get("checkUsername/"+value);
		if(xhrResponse.status == 200) {
			return true;
		}
	}
}

in cant get it to work because of chrome block of Synchronous XMLHttpRequest. Is there a way to do this with async ajax?

Hi,

By default, all requests are done in async. mode. You can use the callback function:

webix.ajax().get(url, params, callback)

Please check the related article: http://docs.webix.com/helpers__ajax_operations.html