As the title says, how to check if the request is an ajax request? This is how I tried to get it, but it is not working :
test_io.dart :
import 'dart:io';
void main() {
  HttpServer.bind('127.0.0.1', 8080)
    .then((HttpServer server) {
      server.listen((HttpRequest request) {
        HttpResponse response = request.response;
        response.write(request.header);
        response.close();
      });
    });
}
test_html.dart :
import 'dart:html';
void main() {
  ParagraphElement p = query('p#text');
  ParagraphElement p1 = query('p#text1');
  p.onClick.listen((MouseEvent event) {
    HttpRequest.request('127.0.0.1:8080', method: 'GET')
      .then((HttpRequest r) {
        p1.text = r.response;
      });
  });
}
test.html :
<html>
  <head>
    <title>testing</title>
  </head>
  <body>
    <p id="text">COBA</p>
    <p id="text1"></p>
    <script type="application/dart" src="testing.dart"></script>
    <script src="packages/browser/dart.js"></script>
  </body>
</html>
After clicking the listening element, it did nothing. So I guess there're 2 questions :
1)How to check if the request is an ajax request, and
2)Why the above code, after clicking the listener p, didn't trigger the callback, I expect that the p1 text get changed because of this line p1.text = r.response;
 
    