Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- $("#cascadeSelection").on("change", function() {
- $(".category").on("click", function() {
- var depth;
- depth = $(this).data("level");
- console.log("Дълбочина: " + depth);
- $.ajax({
- type: "POST",
- dataType: 'json',
- url: "ajax/category/" + $(this).val(),
- }).done(function(msg) {
- if (msg) {
- console.log("Има данни");
- } else {
- console.log("Няма данни");
- }
- var content = '';
- content += '<select name="category" class="category form-control">';
- content += '<option value>Please Select</option>';
- for (key in msg) {
- content += '<option value="' + msg[key].category_id + '">' + msg[key].category_name + '</option>';
- //console.log(msg[key].category_id);
- }
- content += "</select>";
- content += '<div id="sub"></div>';
- $("#sub").html(content);
- });
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement