Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ajax, JSON и преобразование объекта в массив
- var theme = $('#select-diet-form').data('theme');
- var weight = $('#diet-weight option:selected').val();
- var weight_ajax = '&weight_ajax=' + weight;
- $.ajax({
- url: '/wp-content/themes/' + theme + '/ajax-diet.php?select_diet=1' + weight_ajax
- }).done(function(result) {
- result = JSON.parse(result);
- var array = $.map(result, function(value, index) {
- return [value];
- });
- });
- //В php можно кодировать результат в json так:
- // echo json_encode($term_in_posts);
Add Comment
Please, Sign In to add comment