So i am trying to communicate between dart clientside and a php server side using AJAX. Since direct execution is not possible. I compiled the dart to javascript and then run it on a apache server.
json data is generated at client end, But there is no response from the the server
dart code
import 'dart:html';
import 'dart:json';
void main() {
query("#clicker").on.click.add(callServer);
}
void callServer(Event event) {
var data ={ 'name':"sendname"}
,jsondata=stringify(data);
print(jsondata);
var req = new HttpRequest();
req.open('post','http://localhost:8080/darttest/server.php',true);
//req.setRequestHeader('Content-type','application/json');
req.send(jsondata);
print(req.responseText);
}
php side i just echo the content received
<?php
$name = $_POST['name'];
echo $name;
?>
This is my first try at dart programming, so do let me know if this approach is even possible