PolymerElements / iron-ajax

Easily make ajax requests
https://www.webcomponents.org/element/PolymerElements/iron-ajax
127 stars 113 forks source link

Send and reSend problem #277

Open terrak opened 7 years ago

terrak commented 7 years ago

Description

I use one iron-request component to send different requests to php for editing MariaDb database.

The problème I have is if I send a request, I cannot reuse the same xhr, cause is readyState is at 4 (which mean Done)

I have a suggestion for a correction for the send command :


    send: function(options) {
      var xhr = this.xhr;

      if (xhr.readyState > 0 && xhr.readyState != 4 /* DONE */ ) {
        return null;
      }

(adding

&& xhr.readyState != 4 / DONE /

works for me)

Expected outcome

Using multiple time in a componnent the same xhr.

Actual outcome

Can only use one time the xhr componnent

Live Demo

Steps to reproduce

Browsers Affected

mrherndon commented 7 years ago

I came here for this exact reason. It was driving me nuts and I didn't know what I was doing wrong.

It looks like iron-ajax is dynamically creating a new iron-request for every new send.