Skip to content

Instantly share code, notes, and snippets.

@Pan-Maciek
Created October 19, 2016 14:20
Show Gist options
  • Select an option

  • Save Pan-Maciek/0e1aa99250c0edacc44462a9490310d8 to your computer and use it in GitHub Desktop.

Select an option

Save Pan-Maciek/0e1aa99250c0edacc44462a9490310d8 to your computer and use it in GitHub Desktop.
function saveToServer(nazwa) {
$.ajax({
type: "POST",
url: window.location.href.replace("index.html", "") + "Server.aspx",
data: {
operation: "save",
data: JSON.stringify({
nazwa: nazwa,
kolor: color,
time: new Date(),
trasa: JSON.stringify((function () {
var temp = []
for (var i = 0; i < markers.length; i++) {
var m = markers[i]
temp.push({
cords: m.cords,
name: m.name,
zoom: m.zoom
})
}
return temp;
})())
})
},
dataType: "text",
success: function (r) {
console.log(r)
},
error: function (err) {
console.log("error " + err.responseText)
}
})
}
void Save() {
using (var sw = new StreamWriter(HttpContext.Current.Server.MapPath("plik.txt"), true, Encoding.UTF8)) {
sw.WriteLine(Request["data"]+",");
}
Response.Write("save ok");
Response.End();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment