我现在开始学习使用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
任何提示将不胜感激.我不敢相信我自己没有想到这一点,但外面的帮助不能伤害.
问候,
牛
我想知道为什么很难在一个简单的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)