我想在点击时保存四个字段一个是文本框两个复选框和一个使用 ajax 的 wysihtml5Editor 这些如下:
<input type="text" id="title" name="title" required title="required" placeholder="title" data-bind="value:title" />
<input type="checkbox" id="active" name="active" class="check" data-bind="checked: active=='true'"  />Active
<input type="checkbox" id="logon" name="logon" class="check" data-bind="checked: use_logo=='true'"  />Logo
<textarea id="iiii" name="iiii" class="htmleditor" rows="9" cols="50" style="width: 600px; height: 190px;"></textarea>
<button type="button" name="save" id="save" class="btn btn-primary">Save</button> 
我的表名contracts和字段名如下:
title(textbox),def_next(wysihtml5Editor),active(checkbox),use_logo(checkbox)
我这样做的条件如下:
if ($_POST['what']=="save"){} 
我试过ajax作为
$.ajax({
        type: 'POST',
        url: root + 'data/comapanydata_contractorslist?json',
        data: {
            what: "save",
            text: $('#iiii').val(),
            def_text: def_text
        },
        success: function (data) {},
        dataType: 'json'
    });
但不工作所以请建议我这个。