0

I'm trying to add to a <p> element the following string:

(with no charset defined)

Цена: 4,80 BGN Поддръжка:

(directly from .XML file)

&#1062;&#1077;&#1085;&#1072;: 4,80 BGN

but it doesn't work, firebug keeps saying:

$('#sms_hint p').html('aЦена: 4,80 BGN unterminated string literal

and this is how I'm trying to add the html to element:

<?php $promo = "&#1062;&#1077;&#1085;&#1072;: 4,80 BGN";?>    
<script>$('#sms_hint p').html('<?php echo $promo;?>a')</script>

This is an ajax request, an external .php file which contains all code from above, and if an input is changed this should update the index.php file.

Am I need to convert or encrypt to pass data?

4

1 回答 1

0

你不应该把你的 php 和你的 javascript 混在一起。

试试这样:

<script>
var promo = "&#1062;&#1077;&#1085;&#1072;: 4,80 BGN";
$('#sms_hint p').html(promo);
</script>
于 2013-03-11T21:21:53.990 回答