Доброе утро)
Решил использовать jQuery, но столкнулся с большой бедой. Он по русски не алё!
На компе запускаю: index.html
Код | <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.cascade.js"></script> <script type="text/javascript" src="jquery.cascade.ext.js"></script> <script type="text/javascript" src="jquery.templating.js"></script>
<script type="text/javascript"> function commonTemplate(item) { return "<option value='" + item.Value + "'>" + item.Text + "</option>"; }; function commonTemplate2(item) { return "<option value='" + item.Value + "'>***" + item.Text + "***</option>"; }; function commonMatch(selectedValue) { return this.When == selectedValue; }; </script> <style type="text/css"> .cascade-loading { background: transparent url("indicator.gif") no-repeat center; } </style> </head> <body>
<h2 id="ajax_header">Simple Ajax (in ext)</h2> <p>Passes selected value of parent select to url as 'val=', but accepts the full ajax options hash so you can append other data as well</p> <div> <label>Parent <select id="simple_ajax"> <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> <option value="D">D</option> </select> </label> <label>Child <select id="simple_ajax_child"> </select> </label> </label> </div> <script type="text/javascript"> jQuery(document).ready(function() { jQuery("#simple_ajax_child").cascade("#simple_ajax",{ ajax: { url: 'data', complete: function(){ alert('my list is updated'); }, data: { myotherdata: jQuery("#ajax_header").html() } }, template: commonTemplate, match: commonMatch }); }); </script> </body> </html>
|
В файле data лежит:
Код | [{'When':'A','Value':'A1','Text':'попа'},{'When':'A','Value':'A2','Text':'A2'},{'When':'A','Value':'A3','Text':'A3'}, {'When':'A','Value':'A4','Text':'A4'},{'When':'B','Value':'B1','Text':'B1'},{'When':'B','Value':'B2','Text':'B2'}, {'When':'B','Value':'B3','Text':'B3'},{'When':'B','Value':'B4','Text':'B4'},{'When':'C','Value':'C1','Text':'C1'}, {'When':'C','Value':'C2','Text':'C2'},{'When':'D','Value':'D1','Text':'D1'},{'When':'D','Value':'D2','Text':'D2'}]
|
Все работает, но слово "попа" отображается как ����
jQuery взял http://plugins.jquery.com/project/cascade.
Что делать? Как его заставит писать по русски и в кодировке windows-1251? |