Work with Json/jquery



  • There's a query code, like a profile editing, and that's the code.jQuerywhich receives Json format Java:

    $.getJSON('powodyKorektyPG.do', function(data) {
        tmp = data;
        for(var i=0;i<data.length;i++){
            //console.log(data[i].idPowKor);
            $('#select_jsoni').append('<option value="' + data[i].idPowKor+ '">' + data[i].nazwaPowKor + '</option>');
        }
    });
    

    You can do that when you're in input I'm making a memorial and compression.SubmitI get it. Json format in which descriptive statements are recorded and after all Json The format of the redesigned data already? If so? Thank you very much.



  • I understand you're getting a list set. <select>adding to the list.

    There's been some changes. <input> and <select>further made submit forms and as a result, you must obtain data from all forms?

    $('#form').on('submit', function(e) {
        e.preventDefault(); // отменяем стандартную отправку формы
        var dataJson = JSON.stringify($(this).serializeArray()); // получаем все данные с формы и подготавливаем их в json формат
    
    $.ajax({
        url:'powodyKorektyPG.do',
        method: 'post',
        data: dataJson,
        success: function(info) {
            console.log(info);
        }
    });
    

    });




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2