问题描述:

On local server jQuery .post/.get looks like "Content-Type: text/html" but on remote server use CP1251. And my Cyrillic text is encoded.

Why it happens on remote server ?

All files are in utf-8 without BOM, DB is in UTF-8, I send header as header('Content-Type: text/html; charset=utf-8');

 $(document).ready(function() {

$("td.submit_product form").submit(function() {

var id = $(this).find('input[name=product_id]').val();

var qty = $(this).find('input[name=quantity]').val();

var cat_id = $(this).find('input[name=category_id]').val();

$.post(baseurl + "product/add_cart_item", { product_id: id, quantity: qty, category_id: cat_id, ajax: '1' },

function(data){

if(data == 'true'){

$.get(baseurl + "product/show_cart", function(cart){

$("#cart_content").html(cart);

});

$.get(baseurl + "product/cart_total", function(cart){

$("#cart_total").html(cart);

});

}else{

alert("Продукт не существу́ет");

}

});

return false;

});

});

Is only one way to decode .get data ?

Thank you in advance.

相关阅读:
Top