I am trying to submit my form in AJAX, so I have to serialize() the data. But I am using fckEditor
and jQuery doesn't know how to deal with it, so after the serialization, I am trying to manually modify the value, but no luck so far... any ideas
if(content_val!=""){
var values = $("#frmblog").serialize();
values.content = content_val; //content_val is the manually fetched data which I am trying to insert into the serialized content.
alert(content_val); alert(values);
}
serialize
returns a URL-encoded string containing the form fields. If you need to append to it, you do so using the standard URL-encoded string rules, e.g.:(The above assumes there will always be one value in
values
after theserialize
call; if that's not necessarily true, determine whether to use&
based on whethervalues
is empty before you add to it.)Alternately, if you like, you can use
serializeArray
and then add to the array and usejQuery.param
to turn the result into a query string, but that seems a long way 'round:Update: In a comment added later you said:
That changes things. It's a pain to look for
content
within the URL-encoded string, so I'd go with the array:You'd probably want to make this a reusable function.