Sylvester the Cat
April 21st, 2014, 04:39 AM
I wasn't quite sure where to put this so I figured on just putting it here. I need a little assistance to figure out the best way to do this. Here is the situation in a nutshell.
I want to create a database editing program that is HTML/CSS/Javascript based. That is I want to be able to run this editing program in a browser and update xml files based on the information the user puts in. I realize that Javascript will not write to client side files and that I need to be on the server-side of things to do this. PHP looks like it might be a solution but I'm wondering if the client is going to need to install anything on their end to make it work. I am trying to find the more noninvasive solution for the client so they can just open up the program in their browser and edit away. I don't want to have to make them install other things to make this work. However if there is no other way to write to a file, then I guess I'm stuck doing it that way.
One solution I was looking into was through AJAX. This is what I have now.
$.ajax({
url: 'RacesFromCoreRules.xml',
data: $(xml).text(),
type: 'POST',
contentType: "text/xml",
dataType: "xml",
success : function(){alert("Database Updated");},
error : function (xhr, ajaxOptions, thrownError){
alert("Update failed");
console.log(xhr.status);
console.log(thrownError);
}
});
this is not working. It is not updating the file. It returns as succeeded but the file is not updated. Does anyone see what might be the problem here? Is AJAX not a good solution? Is there a better solution? :confused: Thanks a lot! :P
I want to create a database editing program that is HTML/CSS/Javascript based. That is I want to be able to run this editing program in a browser and update xml files based on the information the user puts in. I realize that Javascript will not write to client side files and that I need to be on the server-side of things to do this. PHP looks like it might be a solution but I'm wondering if the client is going to need to install anything on their end to make it work. I am trying to find the more noninvasive solution for the client so they can just open up the program in their browser and edit away. I don't want to have to make them install other things to make this work. However if there is no other way to write to a file, then I guess I'm stuck doing it that way.
One solution I was looking into was through AJAX. This is what I have now.
$.ajax({
url: 'RacesFromCoreRules.xml',
data: $(xml).text(),
type: 'POST',
contentType: "text/xml",
dataType: "xml",
success : function(){alert("Database Updated");},
error : function (xhr, ajaxOptions, thrownError){
alert("Update failed");
console.log(xhr.status);
console.log(thrownError);
}
});
this is not working. It is not updating the file. It returns as succeeded but the file is not updated. Does anyone see what might be the problem here? Is AJAX not a good solution? Is there a better solution? :confused: Thanks a lot! :P