1

First of all. I want to say that i've acctualy read the other posts (like this) but, i don't think it's a good answer. I mean, what about all the status codes, and HyperMedia, etc. What about caching?

What do you think?

1 Answer 1

2

I agree you do need error handling etc. I've been using Dojo, here's code from my blog

var myEdition = {"Edition":{“author”:”x”, “title”"isbn":"44"}};
      var xhrArgs = {
                url: http://myhost/LibraryWink/library/editions,
                postData: dojo.toJson(myEdition),
                handleAs: "json",
                headers: { "Content-Type": "application/json"},
                load: function(data) {
                    dojo.byId("mainMessageText").innerHTML
                           =  "Message posted.";
                },
                error: function(error) {
                    dojo.byId("mainMessageText").innerHTML
                            = "Error :" + error;
                }
            };
        dojo.byId("mainMessageText").innerHTML
                           = "Message being sent…"; 
        var deferred = dojo.rawXhrPost(xhrArgs);

The relevent points here being a). a framework such as dojo (orI guess jquery) helps b). there is handling for errors.

I also have some thoughts in general about REST services and error handling.

Sign up to request clarification or add additional context in comments.

1 Comment

Great djna, i'll take a deeper look.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.