How to get around a 'NS_ERROR_ILLEGAL_VALUE' error using Ajax?

前端 未结 2 1745
生来不讨喜
生来不讨喜 2021-01-12 07:41

Im just writing a small Ajax framework for re-usability in small projects and i\'ve hit a problem. Basically i get a \'NS_ERROR_ILLEGAL_VALUE\' error while send

2条回答
  •  太阳男子
    2021-01-12 08:02

    This error message is one of the 'quirks' of FireFox's XMLHttpRequest object. The same issue in IE will have different symptoms.

    You don't want to deal with all these quirks yourself now that there's lots of good libraries out there.

    For instance in Netscape and FX calling XMLHttpRequestObject.responseText or XMLHttpRequestObject.status throws an "NS_..." error for any connection problems. IE will returns the OS network error code instead - no error thrown. If you handle this yourself you will have to build in the error handling for both.

    I would recommend jQuery. Prototype is also excellent.

提交回复
热议问题