简体   繁体   中英

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM