小编Oxn*_*rth的帖子

如何使用Linkdel与HandelBars链接到外部URL

我现在开始学习使用Ember.js进行Web应用程序开发.目前,我还有一些基本的东西尚未实现.链接到www.google.com等外部网址.这就是我所拥有的:

HTML

<body>
    <script type="text/x-handlebars">
    <div>
      Hello, <strong>{{firstName}} {{lastName}}</strong>!
    </div>

      {{#linkTo google}}Google{{/linkTo}}

    </script>
</body>





$(document).ready(function() {



//alert("HELLO WORLD");
window.App = Ember.Application.create();

App.ApplicationController = Ember.Controller.extend({
    firstName: "Trek",
    lastName: "Glowacki",
    googleURL: "www.google.com/ncr"
});

App.Router.map(function() {
    this.route("google", {
        path: "www.google.com"
    });

});
Run Code Online (Sandbox Code Playgroud)

});

当链接呈现时它确实有效,但它会转到此地址:E:/EMBERJS/index.html#/www.google.com

任何提示将不胜感激.我不敢相信我自己没有想到这一点,但外面的帮助不能伤害.

问候,

frameworks handlebars.js web ember.js

20
推荐指数
1
解决办法
1万
查看次数

将jQuery JSON对象发布到NodeJs Restify

我想知道为什么很难在一个简单的JSON字符串中发布/:parameter以解决问题.我遵循了许多例子,但没有发现任何具体的东西.

我在前端有以下代码.

$("#btnDoTest").click(function() {

    var jData = {
        hello: "world"
    };
    var request = $.ajax({
        url: "http://localhost:8081/j/",
        async: false,
        type: "POST",
        data: JSON.stringify(jData),
        contentType: "application/javascript",
        dataType: "json"
    });


    request.success(function(result) {

        console.log(result);

    });

    request.fail(function(jqXHR, textStatus) {
        alert("Request failed: " + textStatus);
    });


});
Run Code Online (Sandbox Code Playgroud)

如果我在后面连接param,我在发送简单文本方面是成功的j/.但我要发送的是这样的对象,{hello:"world"}并在nodeJS中重新构建它并使用它.

- 编辑:

This is my nodejs file
/* the below function is from restifylib/response.js */
var restify = require("restify");

/* create the restify server */
var server = restify.createServer({

});


server.use(restify.bodyParser({ …
Run Code Online (Sandbox Code Playgroud)

ajax json node.js restify

5
推荐指数
1
解决办法
8604
查看次数

标签 统计

ajax ×1

ember.js ×1

frameworks ×1

handlebars.js ×1

json ×1

node.js ×1

restify ×1

web ×1