Join the Mozilla’s Test Days event from 9–15 Jan to test the new Firefox address bar on Firefox Beta 135 and get a chance to win Mozilla swag vouchers! 🎁

Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

jquery function .post works on chrome & IE but not firefox

more options

I am using a jquery function with .post for logging in. This funciton works in Chrome & IE but not firefox. With firefox I have to try login more than once. The username & password are cache so I am not typing them each time.

$('#submit_login').click(function(e){
        $userLogin = $('#user_login_name').val();
        $userPassword = $('#user_password').val();
        //alert("in submit login" + $userLogin );
        $.post("login_ldap.php", {userLogin: $userLogin, userPassword: $userPassword})

                .done(function(data, status){
                        //alert("success");
                        console.log("Data: " + data + '\nStatus: ' + status);

                })
                .fail(function(xhr, textStatus, errorThrown) {
                        alert("Login error");

                        $("#login_error").text("Login Failed").delay(90000).fadeIn();   

                        console.log("The following error occured: "+ xhr.responseText + " textStatus= " + textStatus + " xhr.error=  " + xhr.error + " errorThrown=  " +errorThrown);
                        console.log(e);
                        //$('#login_error').empty().append(xhr.responseText);
                })
                .always(function() {
                        //alert("finished");
                });
         });

login_ldap.php

try {
echo  bricks_usersDB::login_ldap($userLogin, $userPassword);
    }
    catch ( Exception $e ) {

     echo "\nLOGIN ERROR: " . $e->getMessage();
     error_log($e->getMessage());

    # added header to send error back
      header("HTTP/1.0 404 Not Found");
      exit();
    }
I am using a jquery function with .post for logging in. This funciton works in Chrome & IE but not firefox. With firefox I have to try login more than once. The username & password are cache so I am not typing them each time. <pre><nowiki>$('#submit_login').click(function(e){ $userLogin = $('#user_login_name').val(); $userPassword = $('#user_password').val(); //alert("in submit login" + $userLogin ); $.post("login_ldap.php", {userLogin: $userLogin, userPassword: $userPassword}) .done(function(data, status){ //alert("success"); console.log("Data: " + data + '\nStatus: ' + status); }) .fail(function(xhr, textStatus, errorThrown) { alert("Login error"); $("#login_error").text("Login Failed").delay(90000).fadeIn(); console.log("The following error occured: "+ xhr.responseText + " textStatus= " + textStatus + " xhr.error= " + xhr.error + " errorThrown= " +errorThrown); console.log(e); //$('#login_error').empty().append(xhr.responseText); }) .always(function() { //alert("finished"); }); }); login_ldap.php try { echo bricks_usersDB::login_ldap($userLogin, $userPassword); } catch ( Exception $e ) { echo "\nLOGIN ERROR: " . $e->getMessage(); error_log($e->getMessage()); # added header to send error back header("HTTP/1.0 404 Not Found"); exit(); }</nowiki></pre>

글쓴이 cor-el 수정일시

모든 댓글 (2)

more options

Hi sherryleithner, you need to put <pre> before and </pre> after any code you post here to make it readable (and preferably replace < brackets with &lt; to avoid tags being "eaten"). Alternately, you can use a Github gist or Pastebin, etc.

I can suggest checking for potentially relevant error messages in Firefox's Browser console. You can open the separate Browser Console window using either:

  • "3-bar" menu button > Web Developer > Browser Console
  • (menu bar) Tools > Web Developer > Browser Console
  • (Windows/Linux) Ctrl+Shift+j

Click the trash can icon at the upper left to clear the window, then switch back over to your main window and trigger the login action.

Then switch back over to the console window. Did Firefox log any errors related to that action?

More info on the Browser Console: https://developer.mozilla.org/docs/Tools/Browser_Console

See also: Where to go for developer support

more options

Thank you I did not look in the browser console. This is my first project and I am learning a lot. I get this error message whether login works or not. Which means my .fail is executing when login works and when it fails but only on firefox.

The following error occurred: undefined textStatus= error xhr.error=  function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this} errorThrown=  index.php:120:4

<unavailable>
console.log("The following error occurred: "+ xhr.responseText + " textStatus= " + textStatus + " xhr.error=  " + xhr.error + " errorThrown=  " +errorThrown);
console.log(e);

'My xhr.responseText is undefined not sure why

글쓴이 sherryleithner 수정일시