Reputation: 143
after a JS form serialize i have this:
.....&xx=xxx&otherError=&input=SMS&message=sdfgs&......
How can i change message val before ajax call putting a textarea val?
Thanks in advance,
Steve
Upvotes: 0
Views: 604
Reputation: 115212
Using String#replace
method update the string.
var str = '.....&xx=xxx&otherError=&input=SMS&message=sdfgs&......';
str = str.replace(/&message=[^&]+/, '&message=newvalue');
console.log(str);
Or update the input field value before serializing.
$('[name="message"]').val('newvalue');
Upvotes: 1