亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Iron-ajax 與 Polymer-starter-kit 行為不端或其他東西串聯

Iron-ajax 與 Polymer-starter-kit 行為不端或其他東西串聯

Go
喵喵時光機 2022-01-10 14:28:47
在 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 回答

?
開心每一天1111

TA貢獻1836條經驗 獲得超13個贊

有幾件事。您缺少http:localhost:8080/journal_tagIt should be 中的斜線http://localhost:8080/journal_tag。此外,您可以使用您所在瀏覽器的開發人員工具來查看您發送的所有 XHR 請求。檢查那里以查看正在發送的請求標頭是什么。


查看完整回答
反對 回復 2022-01-10
?
慕桂英546537

TA貢獻1848條經驗 獲得超10個贊

好像在做


document.location.protocol+

"//"+

document.location.host+

"/journal_tag"

修復一切。


查看完整回答
反對 回復 2022-01-10
  • 2 回答
  • 0 關注
  • 191 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號