Jump to content

mootools ajax help


Stickybomb

Recommended Posts

hi i am working on a mootools script for an ajax call to validate some forms. I need to be able to check what is returned and update accordingly.

 

like if it returns false display i would execute an error effect, if not i will display a check mark

 

so i guess i just need to know how to check the results of the response

 

this is what i have so far

$('pass').addEvent('blur', function(e) {
                    new Event(e).stop();
                    new Ajax('includes/process/register.php?field=pass&data='+$('pass').value, {
					method: 'get',
					//what next
					}).request();
                });

 

any help pls

Link to comment
Share on other sites

on and btw, it looks like you're doing a call for every field onblur, id suggest agaist that as it sends unnecessary multiple requests to your server.

 

Why not send all of the form vars onSubmit of the form?

 

Example

var val_form = $('form_id');

val_form.addEvent('submit', function(e){

e = new Event(e).stop();

var form_vars = val_form.toQueryString();

new Ajax('location?' + form_vals,{

//events and settings here

});

});

Link to comment
Share on other sites

onblur is needed for what im trying to do. as for the onComplete is result a variable that is returned or am i supposed to know what to put there cause that is what i am looking for. the documentation is confusing on this. it lists a way to get headers but that is not what i am affter is it?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.