create an associative array in jquery

前端 未结 5 1769
迷失自我
迷失自我 2021-01-01 23:43

This is what I have so far and the shoe types are boots, wellingtons, leather, trainers (in that order)

I want to iterate through and assign th

5条回答
  •  伪装坚强ぢ
    2021-01-02 00:20

    You can try this to create an associate array in jquery

    var arr = {};
    $('[type=number]').each(function(){
        arr.push({
             $(this).attr('id'): $(this).val()              
         });
    });
    
    console.log(arr);
    

    This will allow you to send your all data whatever you want to pass in array by ajax.

提交回复
热议问题