Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Remote validation data as function #237

Closed
marcos-fedato opened this Issue · 2 comments

3 participants

@marcos-fedato

The jQuery ajax does not accept functions as data, it makes sence $.ajax is creared and used at the same time.

The remote validation calls is set once and called a few times.

I use a remote validation for multiple keys on the database so i serialize the all form and passes is on the data param.

But it does not work since if i put the data: $('form:first').serializeArray() it gets only the initial value of the form.

If i put data: function () {$('form:first').serializeArray();} it does nothhing cause $.ajax doesn`t accept functions as data.

i was thinking inchange the remote: function to check the params and parce the param.data if it is a function

if (jQuery.isFunction(param.data))
{
    param.data = param.data();
} 

But i don`t know if it will change the original param, becouse it must retain the function for next calls

more on:

http://forum.jquery.com/topic/function-as-parameter-data-in-ajax-requests

@jzaefferer
Owner

You could use beforeSend as the callback.

@mlynch

Based on other bugs it was decided that using the built-in jQuery Ajax features is preferred vs adding custom features like this. I am going to close this since you can use beforeSend to modify the data before it's sent as @jzaefferer mentions.

@mlynch mlynch closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.