Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game.input.onDown.add(function() {
- x = Math.floor(game.input.activePointer.worldX / 15);
- y = Math.floor(game.input.activePointer.worldY / 15);
- arrayData.push("{'x':'" + x+"','Y':'"+y+"'}");
- document.getElementById('test').innerHTML = ' Data: {"x":' + x+',"Y":'+y+'}';
- console.log(" Data: " + arrayData);
- });
- arrayData.push("{'x':'" + x+"','Y':'"+y+"'}");
- arrayData.push({'x': x,'Y': y});
- var obj = {
- 'x': Math.floor(game.input.activePointer.worldX / 15),
- 'y': Math.floor(game.input.activePointer.worldY / 15)
- };
- arrayData.push(obj);
- $.ajax({
- type: 'POST',
- url: "CollectData.jsp",
- data: {xydata:arrayData},
- dataType: "json",
- success: function(resultData) {
- alert("here");
- console.log("New Data :"+resultData);
- //$("#list").html(resultData);
- }
- });
- String data =request.getParameter("xydata");
- JSONObject obj = new JSONObject();
- obj.put("arr", data);
- try {
- FileWriter file = new FileWriter("D:\test\testFile.json");
- file.write(obj.toJSONString());
- file.flush();
- file.close();
- } catch (IOException e) {
- e.printStackTrace();}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement