sending a charset in the Content-Type header
i use jquery $ajax to post a contact form to my email.
but encoding is wrong and i see question marks.
i figured i should set the content-type but cant manage to do so.
开发者_开发百科am using asp
thx
We can set encoding by contentType and mimeType
jQuery.ajax({
url: "/send_email.html",
data: data,
dataType: 'html', // or json
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
mimeType: 'text/html; charset=UTF-8',
success: function(return_data){
// check return_data if everything is ok
}
});
Reference: http://api.jquery.com/jquery.ajax/
精彩评论