Hi Guys !
I jave a 404 error when I try to load a view from my design doc., My design document is creating ok and also when i get my design document there is no problem but when I try to get the view inside the design document is where i get a 404 error.
Here is my code
To generate the design document i do this:
createDesignDocument: function(designDocumentName, designDocumentViews) {
var data = {
views: designDocumentViews
}
return this.makeRequest("PUT", this.dbUrl + this.dbName + "/" + designDocumentName, {}, data);
}
here is how i am trying to get the view
getView: function(designDocumentId, viewId) {
return this.makeRequest(“GET”, this.dbUrl + this.dbName + “/” +designDocumentId+"/_view/"+viewId);
},
makeRequest: function(method, url, params, data) {
var settings = {
method: method,
url: url,
async: false
}
if(params) {
settings.params = params;
}
if(data) {
settings.data = JSON.stringify(data);
}
settings.success = function(result){
alert("ok: " + JSON.stringify(result));
return result;
}
settings.error = function(error){
alert("error: "+ JSON.stringify(error));
return error;
}
var ajax = $.ajax(settings);
return JSON.parse(ajax.responseText);
}
///// This is my design doc with the view
var designDocView = {“language” : “javascript”,“views”: {“DVProductInventory”: {“map”: “function(doc){if(doc.id){emit(doc.id,null);}}”}}};
/// here i call the method to create it with the name “views2”
cb.createDesignDocument("views2", designDocView);
// here I call the view
cb.getView("views2", "DVProductInventory");
Please if you know why I receive a 404 error tell me why !
Thanks !
Bests.