开发者

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/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜