Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function () {
- $("#move_topic").click(function () {
- $.getJSON(baseUrl + "/sections/json", function (sections) {
- var sectionsSize = sections.length;
- var str = '<b>Move topic</b><br/><select name="section_name" id="section_name" size="' + sectionsSize + '">';
- $.each(sections, function (i, section) {
- str += '<option value="' + section.id + '">' + section.name + '</option>';
- });
- str += '</select>';
- str += '<select name="branch_name" id="branch_name" size="' + sectionsSize + '">';
- str += '<option value="' + 0 + '">          </option>';
- str += '</select>';
- var branchId;
- $.prompt(str, {
- buttons:{ Move:true, Cancel:false},
- loaded:function () {
- $("#section_name").change(function () {
- var sectionId = $(this).val();
- $.ajax({
- url:baseUrl + '/branches/json/' + sectionId,
- success:function (branches) {
- $("#branch_name").children().remove();
- $("#branch_name").append(getBranchHtml(branches));
- }
- });
- });
- $("#branch_name").change(function () {
- branchId = $(this).val();
- });
- },
- callback:function (value, message, form) {
- if (value != undefined && value) {
- $.post(baseUrl + '/topics/json/' + topicId, {"branchId":branchId});
- }
- }
- });
- });
- });
- });
Add Comment
Please, Sign In to add comment