无法将textarea值设置为var

时间:2014-11-13 11:21:38

标签: javascript jquery ajax textarea

我正在尝试将textareas值作为变量,但在console.log上,即使它实际上不是空的,它也会变为空。 这是我的代码:

 $("#enableEdit").click(function () {
            var selectedDescriptionIdentifier = "";
            var selectedFlagIdentifier = "";

            $(".editableDescription, .editableFlag").prop("disabled", false).each(function () {
                $(this).focusout(function () {
                    var requestMac = $(this).attr("data-mac");
                    var requestDescription = $(".editableDescription").val();
                    var requestFlag = $(".editableFlag").val();
                    console.log(requestMac + " - " + requestDescription + " - " + requestFlag)
                    var dataString = 'select=' + encodeURIComponent(requestMac) + '&addDescription=' + encodeURIComponent(requestDescription) + '&addFlag=' + encodeURIComponent(requestFlag);
                    if (requestMac != '' & (requestDescription != '' || requestFlag != '')) {
                        $.ajax({
                            type: "POST",
                            url: "update_db.php",
                            data: dataString,
                            cache: false,
                            success: function (html) {
                                console.debug(dataString);
                            }
                        });
                    }
                    return false;
                });
            })
        });

但是在console.log上这就是我的结果:

  

B8:27:EB:AF:3E:4B - -

任何想法?

非常感谢

0 个答案:

没有答案