php - How can I remove bounding whitespace of unknown origin that surrounds ajax response text? -


i have ajax script inserts response text div. response text surrounded whitespace appears come nowhere. have spent hours looking around solution , nothing work. have tried using trim() on server side (php), , following on client side (javascript/jquery):

data = data.replace(/(^\s+|\s+$)/g,''); data = $.trim(data); 

but none of these things work. has else experienced before, , how can solve issue? way, same thing happens in chrome, firefox, safari, , opera. also, when inspect html in browser there no indication whitespace there, visually there.

could post div using well? jquery use insert text div?

here things can try -

  1. alert data , see if can see whitespace there

  2. place text serialized string (http://api.jquery.com/serialize/) , see if notice whitespace there.


Comments