문제

How to strip all whitespaces (like spaces, tabs, newlines) from jQuery Ajax Data?

data: $('#field1, #field2, #field3').serialize()
도움이 되었습니까?

해결책

Try something like

var array = $('#field1, #field2, #field3').serializeArray();
$.each(array, function(i,o){
    o.value = o.value.replace(/\s/g, '');
})
....
data: array

Demo: Fiddle

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top