Question

var $ajaxForm = $('#form');
$ajaxForm.ajaxForm(function(response) {
     //code
});

This works fine in chrome/firefox/opera/safari, but IE 9 doesn't recognize the submit event. Any ideas?

Was it helpful?

Solution

It looks like this has been asked before. If this is a cross domain request, you may want to check out this discussion as well. From that discussion:

$.ajaxTransport("+*", function( options, originalOptions, jqXHR ) {

    if(jQuery.browser.msie && window.XDomainRequest) {
        var xdr;
        return {
            send: function( headers, completeCallback ) {
                // Use Microsoft XDR
                xdr = new XDomainRequest();
                xdr.open("get", options.url);
                xdr.onload = function() {

                    if(this.contentType.match(/\/xml/)){
                        var dom = new ActiveXObject("Microsoft.XMLDOM");
                        dom.async = false;
                        dom.loadXML(this.responseText);
                        completeCallback(200, "success", [dom]);
                    }else{
                        completeCallback(200, "success", [this.responseText]);
                    }
                };

                xdr.ontimeout = function(){
                    completeCallback(408, "error", ["The request timed out."]);
                };

                xdr.onerror = function(){
                    completeCallback(404, "error", ["The requested resource could not be found."]);
                };

                xdr.send();
          },
          abort: function() {
              if(xdr)xdr.abort();
          }
        };
      }
    });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top