Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-8282

jQuery 1.4 AJAX requests broken if using Richfaces

    XMLWordPrintable

    Details

    • Affects:
      Compatibility/Configuration
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Use the following code:

      if (typeof Sarissa != 'undefined') {
      jQuery.ajaxSetup({
      xhr: function() {
      if (Sarissa.originalXMLHttpRequest)

      { return new Sarissa.originalXMLHttpRequest(); }

      else if (typeof ActiveXObject != 'undefined')

      { return new ActiveXObject("Microsoft.XMLHTTP"); }

      else

      { return new XMLHttpRequest(); }

      }
      });
      }

      Show
      Use the following code: if (typeof Sarissa != 'undefined') { jQuery.ajaxSetup({ xhr: function() { if (Sarissa.originalXMLHttpRequest) { return new Sarissa.originalXMLHttpRequest(); } else if (typeof ActiveXObject != 'undefined') { return new ActiveXObject("Microsoft.XMLHTTP"); } else { return new XMLHttpRequest(); } } }); }

      Description

      If external jQuery 1.4 is used on the same page as richfaces, all asynchronous requests are not working in Internet Explorer (confirmed version 7) with very peculiar error message: "This method cannot be called until open method has been called". jQuery alone works as expected.
      Here's the test code to reproduce the problem:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j">
      <f:view>
      <head>
      <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"> </script>
      </head>

      <body id="wide">

      <script language="JavaScript" type="text/javascript">
      jQuery(document).ready(function() {
      jQuery.ajax({
      url: '/',
      cache: false,
      //context: this,
      success: function(html)

      { alert('success!'); }

      ,
      error: function (XMLHttpRequest, textStatus, errorThrown)

      { alert('failed: ' + errorThrown.message); }

      });
      }
      );
      </script>

      <a4j:form>
      <a4j:commandLink id="saveScreenModeLink" actionListener="#

      {user.save}

      " />
      </a4j:form>
      </body>
      </f:view>
      </html>

      This code works fine in Safari 4 and FF 3.5, but throws seeminlgy msxml.dll related error in IE7 (see screenshot).
      If you remove a4j tag it works in IE7 as well.

        Gliffy Diagrams

          Attachments

          1. screenshot-1.jpg
            screenshot-1.jpg
            21 kB
          2. screenshot-1.jpg
            screenshot-1.jpg
            21 kB
          3. test.xhtml
            1 kB

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                thedotedge Oleg T
              • Votes:
                3 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: