Commit 12b70f12 authored by Siddhant Sanyam's avatar Siddhant Sanyam

jquery's username and pasword is broken. Fixed everything related to $.ajax....

jquery's username and pasword is broken. Fixed everything related to $.ajax. Now we can Auth on GET. Make sure you have <LimitExcept OPTION>require valid-user</LimitExcept> in your Dav .htaccess
parent a3308dcc
...@@ -40,8 +40,11 @@ saveXHR = function(address) { ...@@ -40,8 +40,11 @@ saveXHR = function(address) {
$.ajax({ $.ajax({
url: address, url: address,
type: "PUT", type: "PUT",
username: "smik", headers: {
password: "asdf", Authorization: "Basic "+btoa("smik:asdf")},
fields: {
withCredentials: "true"
},
data: JSON.stringify(getCurrentDocument()), data: JSON.stringify(getCurrentDocument()),
success: function(){alert("saved");}, success: function(){alert("saved");},
error: function(xhr) { alert("error while saving");} error: function(xhr) { alert("error while saving");}
...@@ -53,8 +56,11 @@ loadXHR = function(address) { ...@@ -53,8 +56,11 @@ loadXHR = function(address) {
url: address, url: address,
type: "GET", type: "GET",
cache:false, cache:false,
/* username: "smik", No need to specify credential while GETTING headers: {
password: "asdf",*/ Authorization: "Basic "+btoa("smik:asdf")},
fields: {
withCredentials: "true"
},
success: function(data){ success: function(data){
var cDoc = getCurrentDocument(); var cDoc = getCurrentDocument();
cDoc.load(JSON.parse(data)); cDoc.load(JSON.parse(data));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment