i am trying to write my object to an xml file. but i get error in my Writexml function.
function writexml(listXML) {
$.ajax({
type: 'POST',
url: "c:\\users\nagia\documents\visual studio2013\Projects\Webtrystuff\Webtrystuff\XMLFile1.xml", //path
dataType: 'xml',
data: { filename: "XMLFile1.xml", content: listXML },
error: function () {
alert("Unknown error. Data could not be written to the file.");
},
success: function () {
window.open("XMLFile1.xml");
}
});
}
This is my function to call the writexml.
<script>
$(document).ready(function () {
$("#datepicker").datepicker({
beforeShowDay: function(date) {
var event = events[date];
writexml(event);
if (event) {
return [true, event.className, event.text, event.date];
}
else {
return [true, '', ''];
}
}
})
});
</script>
event is a my object in jquery.
var Event = function (text, className) {
this.text = text;
this.className = className;
};
I have to use ajax. Is there something wrong with sending the object like this? I am a beginner.