Java 记事本++;

Java 记事本++;,java,jquery,html,json,notepad++,Java,Jquery,Html,Json,Notepad++,我已经有一些代码可以在fiddle.net上发布。但当我在记事本++中尝试这些代码时,我无法表达 这种情况的原因可能仅仅是什么?例如,由于我的域名,我更改了url链接。在fiddle.net上我有jquery库,但在Notepad++上我没有,我把一个.js文件下载到我的计算机上。 另一个问题可能是记事本++上的数组,该数组取自fiddele.net,但无法在正确的位置直线粘贴到记事本+ <html xmlns="http://www.w3.org/1999/xhtml"> <

我已经有一些代码可以在fiddle.net上发布。但当我在记事本++中尝试这些代码时,我无法表达

这种情况的原因可能仅仅是什么?例如,由于我的域名,我更改了url链接。在fiddle.net上我有jquery库,但在Notepad++上我没有,我把一个.js文件下载到我的计算机上。 另一个问题可能是记事本++上的数组,该数组取自fiddele.net,但无法在正确的位置直线粘贴到记事本+

<html xmlns="http://www.w3.org/1999/xhtml">
<head> 

<script type="text/javascript" src="C:\Users\ftec805\Desktop\Deneme10\js\jquery-3.1.1.js"></script>
<script>
    //$.getJSON("new4.json", function(data) {
   // console.log(data);

    //$.getJSON('new4.json', function(data) {
    $.each(data.person, function(i, person) {
        var tblRow = "<tr><td>" + person.firstName + "</td><td>" + person.lastName + "</td><td>" + person['Email Address'] + "</td><td>" + person.City + "</td></tr>"
        $(tblRow).appendTo("#userdata tbody");
    });
    //});

    var data = {
    "person": [{
        "firstName": "Clark",
        "lastName": "Kent",
        "Email Address": "Reporter",
        "City": 20
    }, {
        "firstName": "Bruce",
        "lastName": "Wayne",
        "Email Address": "Playboy",
        "City": 30
    }, {
        "firstName": "Peter",
        "lastName": "Parker",
        "Email Address": "Photographer",
        "City": 40
         }, {
        "firstName": "Bruce",
        "lastName": "Wayne",
        "Email Address": "Playboy",
        "City": 30
    }]
} 
</script>
</head>
<body>
<div class="wrapper">
    <div class="profile">
        <table id="userdata" border="2">
            <thead>
                <th>FirstName</th>
                <th>LastName</th>
                <th>EmailAddress</th>
                <th>City</th>
            </thead>
            <tbody>
            </tbody>
        </table>
    </div>
</div>
</body>
</html>

//$.getJSON(“new4.json”),函数(数据){
//控制台日志(数据);
//$.getJSON('new4.json',函数(数据){
$.each(data.person,function(i,person){
var tblRow=”“+person.firstName+“”+person.lastName+“”+person['Email Address']+“”+person.City+“”
$(tblRow).appendTo(“#userdata tbody”);
});
//});
风险值数据={
“人”:[{
“名字”:“克拉克”,
“姓氏”:“肯特”,
“电子邮件地址”:“记者”,
“城市”:20
}, {
“名字”:“布鲁斯”,
“姓氏”:“韦恩”,
“电子邮件地址”:“花花公子”,
“城市”:30
}, {
“名字”:“彼得”,
“姓氏”:“帕克”,
“电子邮件地址”:“摄影师”,
“城市”:40
}, {
“名字”:“布鲁斯”,
“姓氏”:“韦恩”,
“电子邮件地址”:“花花公子”,
“城市”:30
}]
} 
名字
姓氏
电子邮件地址
城市

将您的
//数据JSON bla bla放在
后面,并在
后面附加tbody code>。您也可以将其放在
之前的底部

深刻的解释是

例如:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head> 

    <script type="text/javascript" src="C:\Users\ftec805\Desktop\Deneme10\js\jquery-3.1.1.js"></script>
    </head>
    <body>

    <div class="wrapper">
        <div class="profile">
            <table id="userdata" border="2">
                <thead>
                    <th>FirstName</th>
                    <th>LastName</th>
                    <th>EmailAddress</th>
                    <th>City</th>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </div>

    <script>
        var data = {
        "person": [{
            "firstName": "Clark",
            "lastName": "Kent",
            "Email Address": "Reporter",
            "City": 20
        }, {
            "firstName": "Bruce",
            "lastName": "Wayne",
            "Email Address": "Playboy",
            "City": 30
        }, {
            "firstName": "Peter",
            "lastName": "Parker",
            "Email Address": "Photographer",
            "City": 40
             }, {
            "firstName": "Bruce",
            "lastName": "Wayne",
            "Email Address": "Playboy",
            "City": 30
        }]
    } 
    //$.getJSON("new4.json", function(data) {
    // console.log(data);

    //$.getJSON('new4.json', function(data) {
        $.each(data.person, function(i, person) {
            var tblRow = "<tr><td>" + person.firstName + "</td><td>" + person.lastName + "</td><td>" + person['Email Address'] + "</td><td>" + person.City + "</td></tr>"
            $(tblRow).appendTo("#userdata tbody");
        });
        //});
    </script>
    </body>
    </html>

名字
姓氏
电子邮件地址
城市
风险值数据={
“人”:[{
“名字”:“克拉克”,
“姓氏”:“肯特”,
“电子邮件地址”:“记者”,
“城市”:20
}, {
“名字”:“布鲁斯”,
“姓氏”:“韦恩”,
“电子邮件地址”:“花花公子”,
“城市”:30
}, {
“名字”:“彼得”,
“姓氏”:“帕克”,
“电子邮件地址”:“摄影师”,
“城市”:40
}, {
“名字”:“布鲁斯”,
“姓氏”:“韦恩”,
“电子邮件地址”:“花花公子”,
“城市”:30
}]
} 
//$.getJSON(“new4.json”),函数(数据){
//控制台日志(数据);
//$.getJSON('new4.json',函数(数据){
$.each(data.person,function(i,person){
var tblRow=”“+person.firstName+“”+person.lastName+“”+person['Email Address']+“”+person.City+“”
$(tblRow).appendTo(“#userdata tbody”);
});
//});
无论如何,我建议将脚本放在另一个文件中,然后使用
组织html和js

例如:

index.html

        <html xmlns="http://www.w3.org/1999/xhtml">
    <head> 

    <script type="text/javascript" src="C:\Users\ftec805\Desktop\Deneme10\js\jquery-3.1.1.js"></script>
    </head>
    <body>

    <div class="wrapper">
        <div class="profile">
            <table id="userdata" border="2">
                <thead>
                    <th>FirstName</th>
                    <th>LastName</th>
                    <th>EmailAddress</th>
                    <th>City</th>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </div>

    <script src="js/myScript.js"></script>
    </body>
    </html>

名字
姓氏
电子邮件地址
城市
myScript.js(在js文件夹中)

var数据={
“人”:[{
“名字”:“克拉克”,
“姓氏”:“肯特”,
“电子邮件地址”:“记者”,
“城市”:20
}, {
“名字”:“布鲁斯”,
“姓氏”:“韦恩”,
“电子邮件地址”:“花花公子”,
“城市”:30
}, {
“名字”:“彼得”,
“姓氏”:“帕克”,
“电子邮件地址”:“摄影师”,
“城市”:40
}, {
“名字”:“布鲁斯”,
“姓氏”:“韦恩”,
“电子邮件地址”:“花花公子”,
“城市”:30
}]
}
$.each(data.person,function(i,person){
var tblRow=”“+person.firstName+“”+person.lastName+“”+person['Email Address']+“”+person.City+“”
$(tblRow).appendTo(“#userdata tbody”);
});
希望能有帮助

另外,我建议使用Atom、Sublime Text 3或Vim或其他工具作为文本编辑器。这使我们的生活更容易编码;)

将您的
//数据JSON bla bla放在
之后,并在
之后附加tbody code>。您也可以将其放在
之前的底部

深刻的解释是

例如:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head> 

    <script type="text/javascript" src="C:\Users\ftec805\Desktop\Deneme10\js\jquery-3.1.1.js"></script>
    </head>
    <body>

    <div class="wrapper">
        <div class="profile">
            <table id="userdata" border="2">
                <thead>
                    <th>FirstName</th>
                    <th>LastName</th>
                    <th>EmailAddress</th>
                    <th>City</th>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </div>

    <script>
        var data = {
        "person": [{
            "firstName": "Clark",
            "lastName": "Kent",
            "Email Address": "Reporter",
            "City": 20
        }, {
            "firstName": "Bruce",
            "lastName": "Wayne",
            "Email Address": "Playboy",
            "City": 30
        }, {
            "firstName": "Peter",
            "lastName": "Parker",
            "Email Address": "Photographer",
            "City": 40
             }, {
            "firstName": "Bruce",
            "lastName": "Wayne",
            "Email Address": "Playboy",
            "City": 30
        }]
    } 
    //$.getJSON("new4.json", function(data) {
    // console.log(data);

    //$.getJSON('new4.json', function(data) {
        $.each(data.person, function(i, person) {
            var tblRow = "<tr><td>" + person.firstName + "</td><td>" + person.lastName + "</td><td>" + person['Email Address'] + "</td><td>" + person.City + "</td></tr>"
            $(tblRow).appendTo("#userdata tbody");
        });
        //});
    </script>
    </body>
    </html>

名字
姓氏
电子邮件地址
城市
风险值数据={
“人”:[{
“名字”:“克拉克”,
“姓氏”:“肯特”,
“电子邮件地址”:“记者”,
“城市”:20
}, {
“名字”:“布鲁斯”,
“姓氏”:“韦恩”,
“电子邮件地址”:“花花公子”,
“城市”:30
}, {
“名字”:“彼得”,
“姓氏”:“帕克”,
“电子邮件地址”:“摄影师”,
“城市”:40
}, {
“名字”:“布鲁斯”,
“姓氏”:“韦恩”,
“电子邮件地址”:“花花公子”,
“城市”:30
}]
} 
//$.getJSON(“new4.json”),函数(数据){
//控制台日志(数据);
//$.getJSON('new4.json',函数(数据){
$.each(data.person,function(i,person){
var tblRow=”“+person.firstName+“”+person.lastNa