I want to send an extra parameter to the validation server side script. I have this code:
$("#edit_info").validate({
debug: false,
rules: {
name: {
required: true,
//remote: "validate.php",
remote: { url:"validate.php", async:false },
data: {'cat_id':'34'}
/*data: {
cat_id: function () { return '34'; }
}*/
},
But only the name gets sent. Any idea why? Thanks!
In case you want to send dynamic parameters, instead of static:
$("#edit_info").validate({
debug: false,
rules: {
name: {
required: true,
remote: {
url:"validate.php",
data: {'cat_id':function(){return $('#otherelement').val()}},
async:false
}
},
Found out what the problem was. data must be inside the remote tags...
$("#edit_info").validate({
debug: false,
rules: {
name: {
required: true,
remote: {
url:"validate.php",
data: {'cat_id':'34'},
async:false
}
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With