2013-07-15 35 views
1

以下是我正在开发的功能的简化版本。如果有人能够帮助解决这个问题,我可以很容易地适应我的现实世界。jQuery .val传递到PayPal表单字段的西里尔值

在我的示例中,如果表单是在英文版的input [id = item_name]在JavaScript中处于活动状态的情况下提交的,它就会起作用。使用俄语版本的输入[id = item_name]激活,它不起作用...问题是,当您最终使用PayPal时,说明是Gobbledygook。

如果您在输入[id = item_name]的每个版本都提交表单时处于活动状态,那么当您到达PayPal(位于Description中)时将会看到问题。

<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 
</head> 
<body> 


<form action="https://www.paypal.com/cgi-bin/webscr" method="post" accept-charset="UTF-8"> 

<input type="hidden" name="cmd" value="_xclick"> 
<input type="hidden" name="business" value="[email protected]"> 
<input type="hidden" name="no_shipping" value="1" /> 
<input type="hidden" name="currency_code" value="USD"> 
<input type="hidden" name="lc" value="RU"> 
<input type="hidden" name="item_name" id="item_name" value=""> 
<input type="hidden"name="amount" id="amount" value=""> 
<input name="submit" type="submit" value="Submit"> 
</form> 


<script type="text/javascript"> 


/*This Doesn't Work*/ 
$('input[id=item_name]').val('50 слов перевода'); 

/*This Does Work*/ 
/*$('input[id=item_name]').val('50 Word Translation');*/ 


$('input[id=amount]').val('5.00');  
</script> 


</body> 
</html> 

回答

2

你能为表单添加一个额外的输入字段,看看它是否改变了什么吗?

<input type="hidden" name="charset" value="utf-8"> 

检查这个问题,以及:http://www.nopcommerce.com/boards/t/19293/paypal-greek-characters.aspx#84782 我没有在时刻访问PP沙盒,否则我会试图去帮助更多。

+0

绝对奏效,谢谢。有时你只是盯着某件事太久。谢谢,谢谢:) –

+0

不客气! – 2013-07-16 00:21:31