Vadim.K Vadim.K - 6 months ago 16
jQuery Question

serialize string for sending

I have such code

var serializeValues =$(this).find("input[type='hidden']).not('.table-element').serialize();


The Value:

martial_status=%D0%B6%D0%B5%D0%BD%D0%B0%D1%82+(%D0%B7%D0%B0%D0%BC%D1%83%D0%B6%D0%B5%D0%BC)&evidence_series=11-%D0%B2%D1%84%D1%8B&


This string I am sending as data in ajax. But I have table. I am changing my values from table and in the result I have:

work_status=working


How can I add this string for previous and convert in same format?

UPD

$.ajax({
type: 'POST',
data: serializeValues,
url: url,
complete: function()
{
alert('ok');
}
});


I want to send this ajax request, serializeValues is a data for this request, after that I use
unserialize
in php to get values.I am getting
serializeValues
automatical from form with the help of
.serialize
. And I am generating some string like
work_status=working
and I want add this string to serialize value, but I can't do it.
data: serializeValues+mystring,
is bad way, because in php
unserialize
doesn't work.

Answer

How can I add this string for previous and convert in same format?

Include & at beginning of string, use encodeURIComponent(), concatenate to serializeValues

serializeValues = serizlizeValues + encodeURIComponent("&work_status=working")