ajax working only with mozilla

Discussion in 'Javascript' started by Mariano, Feb 6, 2008.

  1. Mariano

    Mariano Guest

    I have this use of XMLHTTPRequest, but working only with Mozilla like
    browser, not working on IE7:

    function ajaxRequest(func, src, type, p1) {
    var mozillaFlag = false;
    var XMLHttpRequestObject = false;

    if (window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
    //XMLHttpRequestObject.overrideMimeType("text/xml");
    mozillaFlag = true;
    } else if (window.ActiveXObject) {
    XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if(XMLHttpRequestObject) {
    XMLHttpRequestObject.open(type, src, true);
    XMLHttpRequestObject.onreadystatechange = function(){
    if (XMLHttpRequestObject.readyState == 4 &&
    XMLHttpRequestObject.status == 200) {
    var xmlDocument = XMLHttpRequestObject.responseXML;
    if(mozillaFlag){
    removeWhitespace(xmlDocument);
    }
    aFunction(xmlDocument, p1);
    }
    }
    XMLHttpRequestObject.send(null);
    }
    }

    Someone have an idea?
     
    Mariano, Feb 6, 2008
    #1
    1. Advertisements

  2. Mariano wrote:
    > I have this use of XMLHTTPRequest, but working only with Mozilla like
    > browser, not working on IE7:
    >
    > function ajaxRequest(func, src, type, p1) {
    > var mozillaFlag = false;
    > var XMLHttpRequestObject = false;
    >
    > if (window.XMLHttpRequest) {
    > XMLHttpRequestObject = new XMLHttpRequest();
    > //XMLHttpRequestObject.overrideMimeType("text/xml");
    > mozillaFlag = true;


    Well IE 7 supports XMLHttpRequest as a DOM object and that way your code
    with IE 7 ends up in this block and then sets that flag mozillaFlag to
    true. Probably not what you want.

    What exactly is the problem you have with IE 7? Do you get any error,
    which one, for which statement?




    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Feb 6, 2008
    #2
    1. Advertisements

  3. Mariano

    Mariano Guest

    On 6 Feb, 18:46, Martin Honnen <> wrote:
    > Mariano wrote:
    > > I have this use of XMLHTTPRequest, but working only with Mozilla like
    > > browser, not working on IE7:

    >
    > > function ajaxRequest(func, src, type, p1) {
    > > var mozillaFlag = false;
    > > var XMLHttpRequestObject = false;

    >
    > > if (window.XMLHttpRequest) {
    > > XMLHttpRequestObject = new XMLHttpRequest();
    > > //XMLHttpRequestObject.overrideMimeType("text/xml");
    > > mozillaFlag = true;

    >
    > Well IE 7 supports XMLHttpRequest as a DOM object and that way your code
    > with IE 7 ends up in this block and then sets that flag mozillaFlag to
    > true. Probably not what you want.
    >
    > What exactly is the problem you have with IE 7? Do you get any error,
    > which one, for which statement?
    >
    > --
    >
    > Martin Honnen
    > http://JavaScript.FAQTs.com/


    there aren't error message, just freezed interaction!
     
    Mariano, Feb 6, 2008
    #3
  4. Mariano

    Mariano Guest

    On 7 Feb, 01:30, Jeff <jeff@spam_me_not.com> wrote:
    > Mariano wrote:
    > > On 6 Feb, 18:46, Martin Honnen <> wrote:
    > >> Mariano wrote:
    > >>> I have this use of XMLHTTPRequest, but working only with Mozilla like
    > >>> browser, not working on IE7:
    > >>> function ajaxRequest(func, src, type, p1) {
    > >>> var mozillaFlag = false;
    > >>> var XMLHttpRequestObject = false;
    > >>> if (window.XMLHttpRequest) {
    > >>> XMLHttpRequestObject = new XMLHttpRequest();
    > >>> //XMLHttpRequestObject.overrideMimeType("text/xml");
    > >>> mozillaFlag = true;
    > >> Well IE 7 supports XMLHttpRequest as a DOM object and that way your code
    > >> with IE 7 ends up in this block and then sets that flag mozillaFlag to
    > >> true. Probably not what you want.

    >
    > >> What exactly is the problem you have with IE 7? Do you get any error,
    > >> which one, for which statement?

    >
    > >> --

    >
    > >> Martin Honnen
    > >> http://JavaScript.FAQTs.com/

    >
    > > there aren't error message, just freezed interaction!

    >
    > Why don't sprinkle in some alerts so you can see where it freezes?
    >
    > Jeff


    So in that code there aren't visible error in cross-browsing???
     
    Mariano, Feb 7, 2008
    #4
  5. Mariano wrote:

    > So in that code there aren't visible error in cross-browsing???


    You have neither shown the code of removeWhitespace nor of aFunction nor
    the parameters passed to ajaxRequest so it is hard to tell.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Feb 7, 2008
    #5
  6. Mariano

    Mariano Guest

    On 7 Feb, 16:28, Jeff <jeff@spam_me_not.com> wrote:
    > Martin Honnen wrote:
    > > Mariano wrote:

    >
    > >> So in that code there aren't visible error in cross-browsing???

    >
    > > You have neither shown the code of removeWhitespace nor of aFunction nor
    > > the parameters passed to ajaxRequest so it is hard to tell.

    >
    > On a side note, does IE have anything similar to the Moz javascript:
    > error window?
    >
    > Jeff


    I think that it's not usefull to post removeWhiteSpace() and
    aFunction() source. I have this page with 2 link, "Registration Form"
    and "Login Form" the HTML page have onload event on the body tag that
    call AjaxRequest executing a function with HTML code of a registration
    form. And this working good, but if I click on Login Form, i should
    call ajaxRequest with aFunction2 that shoul write Login HTMLcode. but
    this don't happen.
     
    Mariano, Feb 10, 2008
    #6
  7. Mariano wrote:
    > On 7 Feb, 16:28, Jeff <jeff@spam_me_not.com> wrote:
    >> Martin Honnen wrote:
    >>> Mariano wrote:
    >>>> So in that code there aren't visible error in cross-browsing???
    >>> You have neither shown the code of removeWhitespace nor of aFunction nor
    >>> the parameters passed to ajaxRequest so it is hard to tell.

    >> On a side note, does IE have anything similar to the Moz javascript:
    >> error window?
    >> [...]


    Please don't quite signatures.

    > I think that it's not usefull to post removeWhiteSpace() and
    > aFunction() source. I have this page with 2 link, "Registration Form"
    > and "Login Form" the HTML page have onload event on the body tag that
    > call AjaxRequest executing a function with HTML code of a registration
    > form.


    You can post a URL of the test case.

    > And this working good, but if I click on Login Form, i should
    > call ajaxRequest with aFunction2 that shoul write Login HTMLcode. but
    > this don't happen.


    http://www.jibbering.com/faq/faq_notes/clj_posts.html#ps1DontWork
    http://www.jibbering.com/faq/#FAQ4_43

    <FAQENTRY>

    FAQ entry 4.43 should be referred to in FAQ Notes entry
    clj_posts.html#ps1DontWork

    </FAQENTRY>


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
     
    Thomas 'PointedEars' Lahn, Feb 10, 2008
    #7
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henri
    Replies:
    9
    Views:
    1,964
    Toby Inkster
    Feb 22, 2005
  2. =?Utf-8?B?cGF0cmlja2RyZA==?=

    ajax response not working on mozilla

    =?Utf-8?B?cGF0cmlja2RyZA==?=, Feb 15, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    481
    =?Utf-8?B?cGF0cmlja2RyZA==?=
    Feb 16, 2007
  3. minnie
    Replies:
    1
    Views:
    836
    Andrew Thompson
    Dec 13, 2006
  4. cwj

    Mozilla only half working

    cwj, Jan 9, 2004, in forum: Javascript
    Replies:
    1
    Views:
    106
    knocte
    Jan 11, 2004
  5. John
    Replies:
    2
    Views:
    134
    Lasse Reichstein Nielsen
    Jun 26, 2004
Loading...

Share This Page