 
     window.modal_dialog.get_modal_dialog().on "submit",".modal-body .page-posts-form-edit .simple_form", ->
       post_id = $(this).closest(".page-posts-form-edit").attr("data-post-id")
-      event.preventDefault();
+      event.preventDefault()
+      post_form_data = $( this ).serializeArray()
+      tree = that.tree_to_bsns_ctgr
+      if tree isnt undefined
+        tree_ids = $.map($('.modal-content .modal-body .tree').treeview('getChecked', 0),(tree) -> return tree.id)
+        for bsns_id in tree_ids
+          bsns_tree_ids = { 'name' : 'post[business_category_ids][]', 'value' : bsns_id }
+          post_form_data.push( bsns_tree_ids )
+
       $.ajax
         method: "PATCH",
         url: "/posts/"+post_id+"",
-        data: $( this ).serializeArray()
+        data: post_form_data
       .success ( msg ) =>
         that.set_success_im(msg,post_id)
       .error (msg) =>

      if tree isnt undefined
        tree_ids = $.map($('.modal-content .modal-body .tree').treeview('getChecked', 0),(tree) -> return tree.id)
        for bsns_id in tree_ids
          bsns_tree_ids = { 'name' : 'post[business_category_ids][]', 'value' : bsns_id } 
          post_form_data.push( bsns_tree_ids )

      $.ajax

        that.set_failure_im(msg)

    window.modal_dialog.get_modal_dialog().on "click", ".modal-content .modal-body .post_business_categories .bsns_btn", =>
      judge_load = that.judge_inited
      if judge_load is undefined
        ctgr_selected_data = jQuery(".modal-content .modal-body .tree").attr("data-ctgr-selected")
        result = new Array()
        if ctgr_selected_data isnt undefined
          json_obj = JSON.parse(ctgr_selected_data)
          for category in json_obj
            selected_id = category._id.$oid
            result.push(selected_id)
        # if result.length isnt 0
        #   json_result_string = JSON.stringify(result)
        #   json_result = JSON.parse(json_result_string)

        #   console.log( json_result )
        #   console.log result
      jQuery.ajax
        url: "/business_categories.json"
        method: "get"
