在 Firefox 开发人员工具中,我得到以下日志输出: GET XHR http://localhost:8080/localhost:8080/journal_tag即使我想去:http://localhost:8080/journal_tag我尝试将 xhr 响应应该来自的服务器位置数据绑定到变量“this.the_server_url”。但我很难过,因为当我做任何一个console.log(document.location.protocol+document.location.host+"/journal_tag")console.log(this.the_server_url)我明白了"http:localhost:8080/journal_tag"这是服务器端代码应该响应 xhr 请求的地方。因此,Firefox 开发人员工具日志告诉我,iron-ajax 或 iron-ajax 与 polymer-starter-kit 中的 page.js 结合使用是不正常的,即使它在 the_server_url 变量中具有正确的 xhr 目标。如果有人对此有任何想法,我将不胜感激。这是我的 js 代码:<dom-module id="journal-tag"> <template> <paper-input value={{the_new_tag}}> Enter the new tag </paper-input> <paper-button raised on-tap="tap_new_tag"> Submit tag </paper-button> <iron-ajax auto url={{the_server_url}} params={{ajax_new_tag}} handle-as="json" on-response="new_tag_response" last-response={{the_xhr_response}} debounce-duration="300"> </iron-ajax> </template> <script> (function() { 'use strict'; Polymer({ is: 'journal-tag', properties:{ the_new_tag:{ type:String, notify:true }, the_server_url:{ type:String, notify:true }, ajax_new_tag:{ type:String, notify:true }, the_xhr_response:{ type:String, notify:true } }, ready : function(){ this.the_server_url=document.location.protocol+document.location.host+"/journal_tag"; },
- 2 回答
- 0 关注
- 231 浏览
添加回答
举报
0/150
提交
取消
