加载JSON可编辑表单

时间:2014-09-26 17:08:20

标签: javascript jquery json checkbox

我试图在html中加载一个带有可编辑形式但没有成功的JSON文件。

这是表格(JSON文件 - CompleteForm2014.json)

{"type":"Design","zone":null,"children":[{"type":"Page","properties":{"id":"page1"},"children":[{"type":"Content","zone":"content","children":[{"type":"CheckboxGroup","children":[{"type":"Checkbox","properties":{"id":"checkbox1"}},{"type":"Checkbox","properties":{"id":"checkbox2"}},{"type":"Checkbox","properties":{"id":"checkbox3"}}]},{"type":"CheckboxGroup","children":[{"type":"Checkbox","properties":{"id":"checkbox4"}},{"type":"Checkbox","properties":{"id":"checkbox5"}},{"type":"Checkbox","properties":{"id":"checkbox6"}}]}]}]}],"pInfo":{"name":"CompleteForm2014","theme":"Default","accessDate":1404304220520,"device":{"name":"Phones","screenWidth":320,"screenHeight":480,"rotating":false}}}

这是我的HTML文件,用来加载JSON:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">    
    <head>
        <title>title</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <script src="lib/jquery-1.6.4.js"></script>
        <script src="lib/jquery.mobile-1.1.0.js"></script>
        <link href="src/css/jquery.mobile.structure-1.1.0.css" rel="stylesheet"
        />
        <link href="src/css/jquery.mobile.theme-1.1.0.css" rel="stylesheet" />
    </head>    
    <body> 
    </body>
</html>
<script>
var diagnoseForm = (function () {
    var diagnoseForm = null;
    $.ajax({
        'async': false,
        'global': false,
        'url': "../js/CompleteForm2014/CompleteForm2014.json",
        'dataType': "json",
        'success': function (data) {
            diagnoseForm = data;
        }
    });
    alert(diagnoseForm);
    return diagnoseForm;
})();
</script>

任何人都可以帮助我吗?..我只看到一个空白页面,我想看到六个复选框,这是一个表格......

0 个答案:

没有答案