windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

Polymer component iron-ajax make two requests

Asked By: Anonymous

I have a custom element using iron-ajax. I don’t know why the request occurs twice. This is my code:


    <div style="text-align: center" hidden="{{!cargando}}">cargando ... <br />
        <paper-spinner alt="cargando ..." active="[[cargando]]"></paper-spinner>

    <ficha-folleto datos="[[ajaxResponse]]"></ficha-folleto>

        loading="{{cargando}}"> </iron-ajax>

        is: "folleto-digital",
        properties: {

The call is from this page:

<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="elements/folleto-digital/folleto-digital.html">
<!DOCTYPE html>
        <a href="http://bower_components/webcomponentsjs/webcomponents-lite.min.js">http://bower_components/webcomponentsjs/webcomponents-lite.min.js</a>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <folleto-digital idf="" id="folleto"></folleto-digital>
    <a href="http://js/funciones.js">http://js/funciones.js</a>
        var idf = getParameterByName("idf");
        var folleto = document.querySelector("#folleto");
        folleto.idf = idf;

        var len = getParameterByName("len");
        folleto.len = len;

And I’m requesting this url: folleto.html?idf=1&len=es

All is working fine, but there are two request:

  1. api.php?operacion=folleto&idf=&len=
  2. api.php?operacion=folleto&idf=1&len=es

The Polymer documentation says about auto param:

“If true, automatically performs an Ajax request when either url or params changes”

So I think the param at the begining have value=”” and then take the values from the querystring and because of that request twice.

How can I fix this to do one and only one request?



Answered By: Anonymous

When <iron-ajax>.auto is true, the element automatically generates the request if the url is a non-empty string. Since the url has a non-empty value even when idf and len are blank/empty, the <iron-ajax> generates a request even before you’ve set idf and len.

If you want <iron-ajax> to send the request only when idf and len are set, you’d need to remove auto, and add a complex observer on idf and len that generates the request only when both values are not empty.

// template
<iron-ajax id="ajax" ...>
  is: "folleto-digital",

  properties: {
    idf: String,
    len: String

  observers: ['_sendRequest(idf, len)'],

  _sendRequest: function(idf, len) {
    if (idf && len) {

techinplanet staff

Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno
Alanya escort Manavgat escort Fethiye escort Kemer escort Didim escort Gaziantep escort Denizli escort Adana escort Hatay escort Aydın escort İzmir escort Ankara escort Antalya escort Bursa escort İstanbul escort Kocaeli escort Konya escort Muğla escort Malatya escort Kayseri escort Mersin escort Samsun escort Sinop escort Tekirdağ escort Eskişehir escort Yalova escort Rize escort Amasya escort Balıkesir escort Çanakkale escort Bolu escort Erzincan escort Şırnak escort Van escort Yozgat escort Zonguldak escort Afyon escort Adıyaman escort Bilecik escort Aksaray escort Ağri escort Bitlis escort Siirt escort Çorum escort Burdur escort Diyarbakir escort Edirne escort Düzce escort Erzurum escort Kırklareli escort Giresun escort Kilis escort Kars escort Karabük escort Kırıkkale escort Mardin escort Kırşehir escort Maraş escort Manisa escort Muş escort Kastamonu escort Ordu escort Nevşehir escort Sakarya escort Osmaniye escort Şanliurfa escort Sivas escort Trabzon escort Tokat escort Ardahan escort Bartın escort Karaman escort Batman escort Bayburt escort Bingöl escort Elaziğ escort Gümüşhane escort Hakkari escort Isparta escort Uşak escort Igdır escort