Buy Now
Sign in

Ajax validation

Crams , August 04 2018, 20:48
C
Crams 38
August 04 2018, 20:48 #379454
Hi again! I have been trying to validate an input against a data_read array in order to prevent a duplicate, so far what has given me the best result is this javascript:
jQuery("#nem").blur(function() {
var clientx = jQuery("select#client option:checked").val();
var nemx = jQuery("#nem").val();

jQuery.ajax({
url: '{url:search}',
data: {cliente:clientx, nem:nemx},
success: function(result){
}
});
});
The data_read is in an event called search with a php block in the "found" event, with a "return true;"
Everything works fine except that the ajax result is the whole html of the form page, when all I need is that "true" or "false" response...
How do I access that value from the js?
Also is there any other way to achieve this in CF? I'm aware that I could use a "jQuery.fn.form.settings.rules.customfn" but so far this way has given better results.
Thanks in advance!!!
healyhatman 7
August 05 2018, 02:40 #379456
 1
 Answer
Url:'{url:search}&tvout=view'
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
C
Crams 38
August 05 2018, 20:08 #379460
hey Healy! Thanks for your answer! How did you get to that? I read the manual and the faqs and its the first time I see that tvout thing... what does it mean?
healyhatman 7
August 05 2018, 21:17 #379461
 1
Searching through the forums and harassing Bob for help. Don't know what it means or what the other options are haha.
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
C
Crams 38
August 06 2018, 05:32 #379467
Thanks mate, so simple yet so beautiful, works like a charm!