0, введенный в поле ввода текста на веб-странице, обнуляется - PullRequest
0 голосов
/ 29 сентября 2019

Когда поле ввода текста на моей веб-странице получает значение 0, оно меняется на ноль и работает совершенно нормально для всех других строк ввода текста.

Согласно моему анализу (с использованием отладчика Chrome),POST сохраняет данные правильно, как 0. Но при выполнении запроса GET к той же конечной точке значение 0 к этому времени изменится на ноль.

$.ajaxTransport("iframe", function(options, origOptions, jqXHR) {
    var form = null,
      iframe = null,
      name = "iframe-" + $.now(),
      files = $(options.files).filter(":file:enabled"),
      markers = null,
      accepts = null;

    // This function gets called after a successful submission or an abortion
    // and should revert all changes made to the page to enable the
    // submission via this transport.
    function cleanUp() {
        markers.prop("disabled", false);
        form.remove();
        iframe.one("load", function() { iframe.remove(); });
        iframe.attr("src", "javascript:false;");
    }

    // Remove "iframe" from the data types list so that further processing is
    // based on the content type returned by the server, without attempting an
    // (unsupported) conversion from "iframe" to the actual type.
    options.dataTypes.shift();

    // Use the data from the original AJAX options, as it doesn't seem to be
    // copied over since jQuery 1.7.
    // See https://github.com/cmlenz/jquery-iframe-transport/issues/6
    options.data = origOptions.data;

if (files.length) {
      form = $("<form enctype='multipart/form-data' method='post'></form>").
        hide().attr({action: options.originalURL, target: name});

      // If there is any additional data specified via the `data` option,
      // we add it as hidden fields to the form. This (currently) requires
      // the `processData` option to be set to false so that the data doesn't
      // get serialized to a string.
      if (typeof(options.data) === "string" && options.data.length > 0) {
        $.error("data must not be serialized");
      }
      $.each(options.data || {}, function(name, value) {
        if ($.isPlainObject(value)) {
          name = value.name;
          value = value.value;
        }
        $("<input type='hidden' />").attr({name:  name, value: value}).
          appendTo(form);
      });

Я ожидаю, что мое сохраненное входное значение будет постояннымкак 0, но он меняется на ноль.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...