Welcome Guest, Not a member yet? Register   Sign In
jQuery/Ajax form validation
#9

[eluser]jdfwarrior[/eluser]
I never said do all validation in JS. It's posting to a CI function, which happens to be PHP.

Quote:Use the jQuery $.post function. This will post data from jQuery to a php file the same way you should be used to with php. At that point, do your validation of the data. When your done, anything that is echo’d is spit back to jQuery via the callback function. Use that data and display your error message or do whatever with it.

Post to php. Then validate.

Code:
$.post("controller/method", { field1: $("#field1").val(), field2: $("#field2").val() }, function(data) { });

That code, posts to a CI controller/method of choice. Posts the values of field1 and field2. Your CI function can then validate it. If there is an error, echo the error, otherwise echo success message or whatever. That echo'd response is passed back to the data variable in the callback function, which can then handle the response appropriately.

Please read a little closer next time before you respond making me out to be an idiot please. I know there are probably a lot of things I don't know, but you made me out to be a retard, which, was entirely unnecessary.


Messages In This Thread
jQuery/Ajax form validation - by El Forum - 06-29-2009, 02:43 PM
jQuery/Ajax form validation - by El Forum - 06-30-2009, 03:05 AM
jQuery/Ajax form validation - by El Forum - 06-30-2009, 03:16 AM
jQuery/Ajax form validation - by El Forum - 06-30-2009, 05:05 AM
jQuery/Ajax form validation - by El Forum - 06-30-2009, 06:59 AM
jQuery/Ajax form validation - by El Forum - 06-30-2009, 08:06 AM
jQuery/Ajax form validation - by El Forum - 06-30-2009, 08:54 AM
jQuery/Ajax form validation - by El Forum - 06-30-2009, 11:09 AM
jQuery/Ajax form validation - by El Forum - 06-30-2009, 11:23 AM
jQuery/Ajax form validation - by El Forum - 06-30-2009, 11:42 AM
jQuery/Ajax form validation - by El Forum - 06-30-2009, 11:52 AM
jQuery/Ajax form validation - by El Forum - 06-30-2009, 12:42 PM
jQuery/Ajax form validation - by El Forum - 07-01-2009, 06:12 AM
jQuery/Ajax form validation - by El Forum - 07-01-2009, 06:13 AM
jQuery/Ajax form validation - by El Forum - 10-26-2009, 10:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB