Получение данных флажка

0

Извините, что задал еще один простой вопрос, но программа может быть сложной, и, как они говорят, никогда не бойтесь спрашивать. То, что я пытаюсь сделать, это получить jquery, чтобы определить, был ли установлен флажок или нет, когда пользователь нажимает кнопку отправки, а затем переходит к PHP, чтобы сказать, был ли он проверен или нет.

У меня есть данные формы для обработки PHP, такие как текстовые поля, но поля проверки, похоже, не работают.

Я пробовал поиск в Интернете, я ничего не нашел на своем конце

Здесь код

$(document).ready(function () {




    // Make a function that returns the data, then call it whenever you
    // need the current values
    function getData() {
        return {

            login_username: $('#login-username').val(),
            login_password: $('#login-password').val(),
          remember_me: $('#remember_me').find(":checked").val()

        }


    }

  $(":checkbox").click(function(){
    $("#remember_me").text(this.value)
  })
    $('#login_content').hover(function() {
$(this).css("background-color", "transparent");
    });

 $('#login_content').mouseleave(function() {
$(this).css("background-color", "white");
 });

$('.error').hover(function() {
$(this).css("background-color", "transparent");

});

$('.notice').hover(function() {
$(this).css("background-color", "transparent");

});


$('#login_content').mouseleave(function() {
$('.error').css("background-color", "#ffecec");
$('.notice').css("background-color", "#e3f7fc");
});



    $(window).load(function(){
        $('#background_cycler').fadeIn(1500);//fade the background back in once all the images are loaded
          // run every 7s
          setInterval('cycleImages()',4000);
    })




    function loading(e) {
        $('#login_try').show();
    }
    function hide_loading(e) {
    $('#login_try').hide();
    }

    function success_message(e) {
    $('#success_login').html("We're Just Signing You In");
    }



    function clearfields() {
        $('#login-username').val('');  //Clear the user login id field
        $('#login_password').val('');  //Clear the user login password field        
    }

    function check(e) {
        e.preventDefault();
        $.ajax({

            url: 'check.php',
            type: 'post',
            error: function () {
                //If your response from the server is a statuscode error. do this!!!
                clearfields();
            },
            beforeSend: function () {

                loading(e);
            },
            data: {

            login_username: $('#login-username').val(), 
            login_password: $('#login-password').val(),






            }, // get current values







            success: function (data) {

                //if your response is a plain text. (e.g incorrect username or password)

                hide_loading(e);
                if(data.indexOf("<b>Welcome Back</b>") > -1) {
                hide_loading(e);
                success_message(e);
                }

                if(data.indexOf("You're Already Signed In!") > -1) {
                alert('This operation could not be proceeded');
                }


                $('#loading').fadeOut();
                $('#content').hide();
                $('#content').fadeIn(1000).html(data);

            }

        });

    }

    // Don't repeat so much; use the same function for both handlers
    $('#field').keyup(function (e) {
        if (e.keyCode == 13) {
            var username = $('#login-username').val();
            check(e);

        }
    });

    $('#submit_login').click(function (e) {
        if (e.keyCode != 13) {

            check(e);

        }


    });

});
  • 0
    Где твой PHP-код?
  • 0
    Где твой HTML-код?
Показать ещё 3 комментария
Теги:
checkbox

1 ответ

0
var isChecked = ($("#check_box_id").is(':checked')) ? 1 : 0;
//send this variable to the php file.
  • 0
    пробовал что ломает весь скрипт javascript
  • 0
    Большое спасибо;) Просто изменил его для работы с кодом, и он работает;)
Показать ещё 1 комментарий

Ещё вопросы

Сообщество Overcoder
Наверх
Меню