polymerelements / iron-ajax Goto Github PK
View Code? Open in Web Editor NEWEasily make ajax requests
Home Page: https://www.webcomponents.org/element/PolymerElements/iron-ajax
Easily make ajax requests
Home Page: https://www.webcomponents.org/element/PolymerElements/iron-ajax
I'm using iron-ajax 1.0.2, but when i use this:
<iron-ajax
id="loginControl"
handle-as="json"
method="POST"
on-response="getResult"
on-error="getError"
params='{"username":"test", "passowrd":"test2"}'
url="http://localhost/user/login"
>
</iron-ajax>
doesn't send any parm to the server.
I had check with jquery, byy example that the url works properly, but using iron-ajax it doesn't.
i'm missing something? or there is a bug on the code.
PSA: we are going to (soon) remove the general configure
function, which was the predecessor to value
in properties
, and is pretty much an unnecessary duplicate API at this point. Configuring default property values should be moved to properties: { prop: { value: ... } }
. It also looks like a pattern emerged to bind event listener functions to instance methods in configure
; this can just be done in created
instead.
Hi!
How to pass params from properties?
In this case, movieId
:
Polymer({
is: "yts-movie",
movieId: 15,
ready: function() {
console.log('ready yts-movie')
},
ytsMovieResponse: function(event, result){
console.log(result.response)
}
});
<iron-ajax
auto
url="https://yts.to/api/v2/movie_details.json"
params='{"movie_id": "{{ movieId }}" }'
handle-as="json"
on-response="ytsMovieResponse"
debounce-duration="0">
</iron-ajax>
request HTTP is
https://yts.to/api/v2/movie_details.json?0=%7B&1=%22&2=m&3=o&4=v&5=i&6=e&7=_&8=i&9=d&10=%22&11=%3A
My iron-ajax component has the following property values:
url="?contacts&m=login"
method="GET"
//The params are set in javascript
iron_ajax.params = {"full_names":googleUser.getBasicProfile().getName(),"access_token":googleUser.getAuthResponse().id_token,"image":googleUser.getBasicProfile().getImageUrl()}
//When I dump the $_GET variable (json encoded), this is what it returns:
{"c":"contacts","m":"login?full_names=Firstname Lastname","access_token":"e........."}
๐
I then went and changed the question '?' mark here:
https://github.com/PolymerElements/iron-ajax/blob/master/iron-ajax.html#L306
to an ampersand '&' and now my dump looks like this:
{"c":"contacts","m":"login","full_names":"Firstname Lastname","access_token":"eyJh.......}
๐
That seemed to have solved the problem, you might want to check that out.
Bower is tripped by the fact that the v0.9.0 tag doesn't match the bower.json version (0.9.1 in this case).
Hi... Please look the below code
<iron-ajax
auto
url="https://ajax.googleapis.com/ajax/services/search/news?v=1.0&rsz=8&pz=1&cf=all&ned=in&hl=en&topic=tc"
handle-as="json"
last-response="{{ajaxResponse}}"></iron-ajax>
<template is="dom-repeat" items="{{ajaxResponse.responseData.results}}">
<paper-material elevation="1" class="paper-font-body2">
<h1>{{item.title}}</h1>
<iron-image src="[[item.image.url]]" style="width:800px; height:450px; background-color: lightgray;" sizing="cover" preload fade></iron-image>
<p>{{item.content}}</p>
</paper-material>
</template>
Simple right ? but sadly it's throwing below error
XMLHttpRequest cannot load https://ajax.googleapis.com/ajax/services/search/news?v=1.0&rsz=8&pz=1&cf=all&ned=in&hl=en&topic=tc. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.
I asked the same question in SO but got response from one guy he told me to use byutv-jsonp and that's too having the some issue like only receive []
response not {}
response. Finally I'm here for answer...
For non-200 responses, I was expecting on-error to be called, but it seems these are always triggering on-response regardless of error code.
In the event that a non-200 response is received, the response body is not made available to the caller. Data in the error's response body will often contain information that can help the client inform the user about the nature of an error.
As far as I can tell loading
is declared but never modified, and activeRequests
is pushed to but not popped from upon request completion.
I really don't care for this component's predecessor, core-ajax. Inserting an element into the template section of the code is awkward and attribute string limitations suck, I really want parameterized queries.
Why don't you just throw an Ajax utility function into Polymer?
I have an annoying behavior of iron-ajax
that has bitten me a few times so I'm curious if we could get some discussion about this. Example, if you have an iron-ajax
defined as so:
<iron-ajax auto url="[[_urlFor(user)]]"></iron-ajax>
Here, _urlFor(user)
is a computed binding. Polymer 1.0 is smart enough to not set this value until user
is defined the first time, so if user
is null, the iron-ajax
element's url
property becomes the default empty string. However, the auto
mode of the iron-ajax
element will make it make a request anyway: to the root of the domain your browser is on.
The problem I'm having is that it auto-requests before binding completes. For example, if I have something roughly like this (even though this syntax is wrong, just understand my-element
has a property named userId
):
<my-element user-id="zuck">
<!-- in shadow -->
<iron-ajax auto url="[[_urlFor(userId)]]"></iron-ajax>
</my-element>
When creating the my-element
it creates the iron-ajax
which immediately sends a request though its url is empty. Fractions of a second later, back in my-element
it finishes creating its DOM and sets up the bindings, this causes iron-ajax
to update its url using the computed binding, setting the right URL.
So when the dust settles I have a spurious request that is almost guaranteed to be pointless, followed immediately by the legitimate request that I expect.
A possible fix for this would be simply to make the auto-request require that the url is not an empty string, otherwise not actually make the request. If you did need to hit the root, you would set the url as simply /
, which is what most people would do anyway.
What do you think?
https://github.com/PolymerElements/iron-ajax/blob/master/iron-ajax.html#L393
The comparison in discardRequest
checks that the index is greater than zero, however indexOf
may return zero if the searched-for request is the first element in the array. This means the first request would not be discarded. This comparison most likely should be requestIndex >= 0
.
Example url gdata.youtube.com/feeds/api/videos
used in docs and examples returns a 410.
I was just speaking with someone on Slack about passing arrays into params and after a bit of testing I see that params converts an array to:
arr=1%2C2%2C3
this is the result of:
params: {arr = [1,2,3]}
This is the result of URI encoding the actual array... While there is no standard way to interpret arrays in QueryParams the 2 camps most often seen is that arrays break down into:
?arr=1&arr=2&arr=3
or
?arr[]=1&arr[]=2&arr[]=3
It would seem logical that iron-ajax either used one of these patterns or provide a simple means of overriding the queryString method
In Documentation - API Reference - the example for body is wrong
instead of
<iron-ajax method="POST" auto url="http://somesite.com" body='{"foo":1, "bar":2}'> </iron-ajax>
it should be
<iron-ajax method="POST" auto url="http://somesite.com" body='foo=1&bar=2'> </iron-ajax>
Thanks
I want to display the server responses for context when errors occur (as I was able to do with core-ajax in v0.5), but the last-error object itself only contains a Polymer-generated string (Error: The request failed with status code: 500) and the last-response object is undefined.
From @ahumblenerd on June 20, 2015 15:0
<dom-module id="my-new-app">
<style>
</style>
<template>
<iron-ajax
id="ajax"
handle-as="json"
content-type="application/json"
method="POST"
body={"user":2,"dob":"2015-06-10","jobs":1,"skills":[],"about":"cool"}
on-response="hresponse"
debounce-duration="3000">
</iron-ajax>
<button on-click="setajax">Click me</button>
</template>
<script>
Polymer({
is: "my-new-app",
setajax: function () {
this.$.ajax.url="http://127.0.0.1:8000/users/";
this.$.ajax.generateRequest();
},
hresponse: function(request) {
console.log(request.detail.response);
console.log(this.$.ajax.lastResponse);
console.log(this.$.ajax.params);
}
});
</script>
</dom-module>
This does not post data correctly to the server. Also when i put in a console.log inside the iron-ajax.html file i found out that contentType was still set as application/x-www-form-urlencoded
. The documentation says we can specifiy contentype by specifiying contentType = {String}
.
Copied from original issue: Polymer/polymer#1929
The documentation seems to use a deprecated youtube API. Please update when you can.
Is .go()
method missing?
Hello together,
I have an issue with the following iron-ajax:
<iron-ajax
id="ajaxLogin"
url="www.example.org"
method="POST"
on-response="handleResponse"></iron-ajax>
I start the request by
var test = '{ "username" : "testname" }';
this.$.ajaxLogin.body = test;
this.$.ajaxLogin.generateRequest();
My PHP-File contains only this:
echo 'POST: ' . $_POST['username'];
But nothing is shown.
Is this a bug?
Thank you!
Lars
Setting auto
and params
on iron-ajax
triggers generateRequest()
even if the url is not set. This causes bogus request with '/' url.
Proposed fix:
'requestOptionsChanged()' should not trigger generateRequest()
unless url is set.
requestOptionsChanged: function() {
if (!this.url) return;
}
Audit results:
[Severe] Elements with ARIA roles must use a valid, non-abstract ARIA role (1)
[Warning] Text elements should have a reasonable contrast ratio (1)
[Warning] The purpose of each link should be clear from the link text (1)
Not applicable tests (10)
Passing tests (4)
The alt text for the link is "link image watch". It should be something a bit more descriptive about where the user will be taken upon clicking. This is less a concern about the demo page and more that the developer should just be sure to use better labels there.
I am trying send the value of an input field residing within a polymer template as part of a request header, and i was wondering if this is simply not supported...?
I used to do it with setRequestHeader() on an XMLHTTPRequest. Now that I want to refactor using <iron-ajax>
I don't find a way to achieve this.
<input id="inputaccesstoken" type="text" value="{{accesstoken::input}}"></input> <iron-ajax id = "doGetToken" url="https://api.pushbullet.com/v2/users/me" handle-as="json" on-response="handleGetToken"> </iron-ajax>
...
<script> Polymer({ is: 'PushBullet-access-token', preventDispose: true, properties: { accesstoken: { type: String }, },
...
I tried
this.$.doGetToken.headers '{"Authorization": "Bearer ' + this.accesstoken + '"}';
and I tried some kind of data-binding
<iron-ajax
...
headers={{getAuthHeader}} </iron-ajax>
where getAuthHeader is a method returning the accesstoken property.
Neither approach worked.
I'm trying the following code to send ajax requests:
<iron-ajax
id="fetchData"
url="/foo.php"
handle-as="json"
on-response="_fetchDataSuccess"
on-error="_fetchDataFailure"
method="POST"
last-response="{{fetchDataResponse}}"
debounce-duration="500"
body=''>
</iron-ajax>
Which works fine, until I expect _fetchDataFailure
to be called. I pull my internet cable and create a request, and _fetchDataSuccess
is still called EVEN THOUGH I don't have any internet connection and the message in the console is a clear FAILURE indicating I have no internet.
This behavior is very weird. Looking at the source I can see the issue which I hope can be resolved: https://github.com/PolymerElements/iron-ajax/blob/master/iron-request.html#L120
Any workarounds?
<iron-ajax id="ajax1" url="/upload" method="POST" content-type="multipart/form-data"></iron-ajax>
<iron-ajax id="ajax2" url="/upload" method="POST"></iron-ajax>
var fd=new FormData();
fd.append("name","John");
fd.append("where","Here");
this.$.ajax1.body=fd;
this.$.ajax1.generateRequest();
this.$.ajax2.body=fd;
this.$.ajax2.generateRequest();
ajax1
: The server receives an invalid multipart/form-data
request.
ajax2
: All pairs of form key/value are squeezed into one pair of key/value. The server receives something like this:
key:
-------WebKitFormBoundaryqArehja7
Content-Disposition: form-data; name
value:
"name"
John
-------WebKitFormBoundaryqArehja7
Content-Disposition: form-data; name="where"
Here
-------WebKitFormBoundaryqArehja7--
After the following two statements are inserted into line# 323 in function requestHeaders()
, the server appears to receive good requests:
if(this.body instanceof FormData)
delete headers["Content-Type"];
Hi,
how can I get the response body for requests that throw an error?
Neither the last-error property nor the parameters given to the on-error function seem to contain a reference to the error body.
I need to be able to forward the error messages over to the user in order to use it productively.
Regards,
Kylex
Using contentType attribute does not work for 1.0.0, the default 'application/x-www-form-urlencoded' is always used.
Setting Content-Type in headers attribute does work.
just like core-ajax used to do, iron-ajax should expose the progress property
In chromium developer tools (Version 43.0.2357.81 Ubuntu 14.04 (64-bit)), I can select the element and do
$0.headers
"{"X-Requested-With": "XMLHttpRequest", "Authorization": "Basic M2Q4NjU0MmItMjA3Ny00ZDNlLThhNjQtMmY5MzU0NTNiMDljOjkxMWMyZDUzLTM1ZjQtNGMyZC04NmNkLWI4OTgyMzZkYzMwMg=="}"
$0.generateRequest()
Then the network view -> xhr shows
Request URL:http://localhost:4000/3%3A4/authcheck
Request Method:GET
Status Code:401 Unauthorized (from ServiceWorker)
Response Headers
access-control-allow-origin:http://localhost:3000
content-length:15
content-type:text/plain; charset=utf-8
date:Thu, 09 Jul 2015 03:03:14 GMT
www-authenticate:Basic realm="Authorization Required"
Request Headers
Provisional headers are shown
Content-Type:application/x-www-form-urlencoded
Referer:http://localhost:3000/?target=3:4&env=development
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/43.0.2357.81 Chrome/43.0.2357.81 Safari/537.36
Neither this window nor the chrome://net-internals dump shows the authentication header in the request
And then (unknown if related) there is some kind of infinite loop and crash, I can't seem to figure out how to debug where it is, something about polymer 1.0 is capable of doing some bad things to chromium developer tools.
(for instance I can get it into states where $() doesnt work in the console anymore without reloading the browser)
Hi,
When you pass header to iron-ajax component int this way
//ajax is a reference to <iron-ajax....></iron-ajax>
ajax.headers = {
'Accept': 'application/json, text/javascript, */*; q=0.01',
'other': 'other_value'
};
the component is not copying the headers in "requestHeaders" before send the request.
In the method
get requestHeaders() {
var headers = Object.create(this.headers || {});
if (!('content-type' in headers)) {
headers['content-type'] = this.contentType;
}
return headers;
},
"headers" is an object with the propterties you passed included in its prototype. So , by exmaple, the checking
if (!('content-type' in headers)) {
always comes in the block and the passed headers will never be sent later in the request
In example:
<iron-ajax
auto
url="http://gdata.youtube.com/feeds/api/videos/"
params='{"alt":"json", "q":"chrome"}'
handle-as="json"
on-response="handleResponse"
debounce-duration="300"></iron-ajax>
on-response is declared, but it is not in any of the documentation Properties.
When setting contentType
property - as indicated in the docs - for instance, like this:
<iron-ajax
...
contentType="application/json"
...>
</iron-ajax>
iron-ajax
is not working properly since it doesn't establish the Content-Type
header in the XMLHttpRequests object - which belongs to iron-request
. As a workaround, using header property instead contentType property, it just works.
<iron-ajax
...
headers='{"Content-Type": "application/json"}'
...>
</iron-ajax>
When running the demo all I get is a image with a frown and https://youtube.com/devicesupport. The youtube api syntax may have changed.
Right now when specifying Authorization headers, upon the request returning a 401 status code the user agent will handle the request by asking for credentials (modal).
However, one might want to be able to handle this response through the iron-ajax response callback function.
To solve this the xhr.open() function has to be modified according to the following w3c spec:
If the user agent supports HTTP Authentication and Authorization is not in the list of author request headers, it should consider requests originating from the XMLHttpRequest object to be part of the protection space that includes the accessed URIs and send Authorization headers and handle 401 Unauthorized requests appropriately.
If authentication fails, Authorization is not in the list of author request headers, request username is null, and request password is null, user agents should prompt the end user for their username and password.
If authentication fails, Authorization is not in the list of author request headers, request username is non-null, and request password is non-null, user agents must not prompt the end user for their username and password. [RFC2617]
End users are not prompted if username/password are provided through the open() API so that authors can implement their own user interface.
See: http://www.w3.org/TR/XMLHttpRequest1/
and
http://www.w3.org/TR/XMLHttpRequest1/#dom-xmlhttprequest-open
The solution for this would be to add the ability to specify the username and password as parameters in the xhr.open() function.
e.g.
xhr.open(
options.method || 'GET',
options.url,
options.async !== false,
options.username,
options.password
);
Of course a check will have to be made whether or not the username and password are actually provided. I will leave that implementation up to you.
When setting handle-as: 'xml', the response is correctly identified as XML but the xhr.responseType expects 'text' instead of 'xml' at 203:
xhr.responseType = xhr._responseType = (options.handleAs || 'text');
This results in the warning:
The provided value 'xml' is not a valid enum value of interface XMLHttpRequestResponseType.
I have problems uploading very big strings (base64 encoded images) with iron-ajax.
<iron-ajax id="post"
url="https://undergogos.appspot.com/_ah/api/undergogo/v1/image"
on-response="postResponded"
handleAs="json"
method="POST"
last-response="{{postResponse}}"
></iron-ajax>
postGo:function(img64){
this.$.post.body= '{"img":' + img64 + '}';
this.$.post.generateRequest();
},
The above results in 400 parse error on an Endpoints API as it is an String not an Object. Uploading it with the params attribute works fine as long the images are very small (<10KB). With bigger images, Chrome fires net::ERR_CONNECTION_CLOSED
Changing the body attribute in iron-ajax to an Array and passing form data works:
iron-ajax:
body: {
type: Array,
value: function() {
return [];
}
}
request:
var formData = new FormData();
formData.append("img", img64);
this.$.post.body= formData;
this.$.post.generateRequest();
It also works when doing an iron-request instead of an iron-ajax-request as the body attribute of iron-request supports (ArrayBuffer|ArrayBufferView|Blob|Document|FormData|null|string|undefined). Why doesn't iron-ajax support that data types?
While using iron-ajax I am unable to use the loading
attribute as described in the docs.
Upon closer inspection I don't see anything in iron-ajax.html
that even touches the loading
property. Has this been implemented and I'm being foolish or is this missing?
If <iron-ajax>
makes a request and can't connect to the server (e.g. the webserver is down) it triggers the on-response
handler.
I expect it to trigger the on-error
handler and set lastError
, as it does e.g. for a 404
response.
Possibly related to #19 and #17.
For clarity, below is a complete example (my-elem.html
and index.html
) and the steps I'm taking.
python3 -m http.server
<iron-ajax>.generateRequest()
โ the on-response
handler runs and prints ev.detail.response null
, ev.detail.xhr.status 0
. Afterwards, the xhr.addEventListener('error', โฆ)
handler runs (at Line 179 in 6ed75a4
on-error
handler doesn't run and lastError
is not set.net::ERR_CONNECTION_REFUSED
case by running its onerror
handler.<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/iron-ajax/iron-ajax.html">
<dom-module id="my-elem">
<template>
<iron-ajax id="ajax" url="/dummy"
on-response="handleResp"
on-error="handleErr"></iron-ajax>
<button on-click="useIronAjax">Iron-Ajax</button>
<button on-click="useXHR">XmlHttpRequest</button>
</template>
</dom-module>
<script>
Polymer({
is: 'my-elem',
handleResp: function(ev) {
console.log('Response', ev.detail.response, 'status', ev.detail.xhr.status);
},
handleErr: function(ev) {
console.log('Error');
},
useIronAjax: function() {
this.$.ajax.generateRequest();
},
useXHR: function() {
var xhr = new XMLHttpRequest();
xhr.onerror = function() {
console.log('XHR error');
}
xhr.open('GET', '/dummy', true);
xhr.send();
}
});
</script>
<!DOCTYPE html>
<html>
<head>
<script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="my-elem.html">
</head>
<body>
<my-elem></my-elem>
</body>
</html>
Request URL:http://localhost:4000/13%3A6/requestauth
Request Method:POST
Status Code:200 OK (from ServiceWorker)
Response Headers
access-control-allow-credentials:true
access-control-allow-headers:Authorization, Origin
access-control-allow-methods:POST, GET, OPTIONS
access-control-allow-origin:http://localhost:3000
content-length:0
content-type:application/json; charset=utf-8
date:Sat, 11 Jul 2015 21:02:05 GMT
Request Headers
Provisional headers are shown
Authorization:Basic MWI3NWQxODQtZGJkMi00MGJlLTk5OGEtYzc2ZmRiY2NmYTExOjA4MzRlOTFlLTM4NWMtNDMzMS04MzUwLWY0ODhlYTM1MTBiMw==
Content-Type:application/x-www-form-urlencoded
Origin:http://localhost:3000
Referer:http://localhost:3000/?target=13:6&env=development
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/43.0.2357.130 Chrome/43.0.2357.130 Safari/537.36
A purposefully empty body, with a 200 response code, and content-type: json results in the
this.$.ajaxid.lastResponse = null
Is there a reason this property doesn't exist instead of being an empty object?
Reminds of the days when I had to null check every single thing I was referencing in Java.
Hello,
Can we please allow the content type to be omitted & calculated by the browser/user agent in some cases ? Removing Content-Type
does not seem to be supported.
An example where this may be useful is when the content-type
attribute is specified as multipart/form-data
.
This was handling pretty well by core-ajax
not sure why this was changed when it was ironized!
Thanks
@jongeho1
Hi,
I'm not sure if this would be considered a bug, or merely an unfortunate design decision, but, iron-ajax is a pain to use with POST requests with PHP.
Sending a POST request with data params to my PHP page results in params added to queryString, but not POST body. Despite the fact that request headers' method is correctly set to POST, PHP interprets query string params as $_GET, and $_POST is empty.
Iron-ajax does not provide a way to convert an object to query string via a simple interface, and I have to do this gymnastics for each request:
var queryParts = [];
for (param in myParams) {
var value = myParams[ param ];
var param = window.encodeURIComponent( param );
if ( value !== null ) {
param += '=' + window.encodeURIComponent( value );
}
queryParts.push(param);
}
ajax.method = 'POST';
ajax.body = queryParts.join('&');
ajax.generateRequest();
I believe it would be better if this was handled this way by default, internally.
Hi,
I am trying to make a login component using iron-ajax.
I manage to get my component working but I got one problem.
Here's my code :
_user matches the type {username: string, password: string}
.
<login-form
credentials="{{_user}}"
on-login="handleLogin">
</login-form>
<iron-ajax
id="ajax"
url="http://localhost:3000/user"
method="POST"
content-type="application/json"
last-response="{{_response}}">
</iron-ajax>
handleLogin: function() {
this.$.ajax.body = JSON.stringify(this._user);
this.$.ajax.generateRequest();
}
This is working fine. But I am uncomfortable with the this.$.ajax.body = JSON.stringify(this._user);
line.
I can't get it working by passing body="[[_user]]"
to the iron-ajax component.
This example is not working because iron-ajax send [object Object] in the POST request body. The json object passed with body attribute isn't stringified.
<login-form
credentials="{{_user}}"
on-login="handleLogin">
</login-form>
<iron-ajax
id="ajax"
url="http://localhost:3000/user"
method="POST"
content-type="application/json"
body="[[_user]]"
last-response="{{_response}}">
</iron-ajax>
handleLogin: function() {
this.$.ajax.generateRequest();
}
Is the the expected behavior ? If not is it possible to stringify the body if its type is Object ?
Thanks in advance,
Thomas
IMO, iron-ajax should service only one request per instance. If a new request is made before an earlier one has completed, the earlier request should be orphaned and only the new request should be serviced.
Applications that need to make multiple parallel requests would do this with a repeat or imperatively (or conceivably with some sort of iron-multi-ajax
element).
This is a request to handle connection issues better in core-ajax connection issues returned a response of 0 might be better to return the actual error i.e. net::ERR_NAME_NOT_RESOLVED
Hi, There are already two issues that talk about the error handling not managing xhr.status and assume that all response is of value 200. In the old core-xhr.html it sends the full line 68 "return xhr;" in iron-request sends the xhr.response-. Are there any plans to send the full xhr object as some projects may be performing on handling based on the status or header ? Might might be useful to have the default in the line 232 of iron-request.html that currently return the xhr.responseText to return xhr instead. For the json object maybe something like { status:200, header:"???", response:"???"}.
I made a simple request json in iron-ajax, like:
<paper-material elevation="1" style="min-width:400px">
<template is="dom-bind">
<h1>Test2</h1>
<iron-ajax
auto
url="/test.json"
handle-as="json"
last-reponse="{{datalist}}"
></iron-ajax>
<template is="dom-repeat" repeat="[[datalist]]">
<p>[[item.name]]</p>
</template>
</template>
</paper-material>
in network show the list retrieve but the datalist is not populated.
my bower.json
...
"dependencies": {
"paper-elements": "PolymerElements/paper-elements#latest",
"iron-ajax": "PolymerElements/iron-ajax#~1.0.2"
}
...
I have an iron-ajax element like this
and i generate ajax in my js
var username = this.$.username.value;
var password = this.$.password.value;
var ajax = this.$.ajax;
ajax.params={"login" : username,"password" : password};
ajax.generateRequest();
So the request was sent but my params are in the url like with "GET" method
(http://localhost/connexion.php?login=aezr&password=azer)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.