开发者

sending a charset in the Content-Type header

开发者 https://www.devze.com 2022-12-09 01:12 出处:网络
i use jquery $ajax to post a contact form to my email. but encoding is wrong and i see question marks.

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消