Reputation: 42099
$.post('/ur.l'
, jQuery('selectors').serialize()
+ '&textareaname=" + escape( $("#textarea").val() )
, function(data) { ... }
}
);
$.post('/ur.l'
, {'foo':'bar', 'foobar','qazbar'}
, function(data) { ... }
);
Is it possible to combine the object into {...}
the jQuery serialization?
jQuery doesn't seem to serialize textareas, is there a better method than the above? I've tried and see that the textarea is in the jQuery object, but the text is blank:
jQuery('input, textarea').serialize()
Upvotes: 2
Views: 2009
Reputation: 29831
jQuery.param will serialize an object into a url encoded string. You can then combine them together.
serialize
does works with textareas. Make sure you have a valid name on the textarea, and that it is not disabled.
Upvotes: 4
Reputation: 23
You should try and give your form an id and refer to the form parameters through that. For example if you form was had an id of #form.
$("#form").submit( function () {
$.post(
'ur.l',
$(this).serialize(),
function(data){
});
return false;
});
});
and $(this) will be the contents of all of your form parameters. Also in case you are not doing so already, take a look at the headers.
Upvotes: 0