我有一个看起来像这样的 div:
<div class="productOptionPickListSwatch">
<ul>
<li class="swatch hasPreview swatchOneColour">
<label for="e3385b72a9a0c62514edf1a2e6047556">
<span class="previewContent">
<span class="
swatchColours swatchOneColour showPreview
" title="Black">
<span class="swatchColour swatchColour_1" style="background-color:#000000;"> </span>
</span>
</span>
<input type="radio" class="validation" name="attribute[1214]" value="854" id="e3385b72a9a0c62514edf1a2e6047556">
<span class="name">Black</span>
</label>
</li>
<li class="swatch hasPreview swatchOneColour">
<label for="0d865ed51c5d307d7f98f457fc20e9fa">
<span class="previewContent">
<span class="
swatchColours swatchOneColour showPreview
" title="Maroon">
<span class="swatchColour swatchColour_1" style="background-color:#3c1915;"> </span>
</span>
</span>
<input type="radio" class="validation" name="attribute[1214]" value="857" id="0d865ed51c5d307d7f98f457fc20e9fa">
<span class="name">Maroon</span>
</label>
</li>
<li class="swatch hasPreview swatchOneColour">
<label for="be3c11263d03737fd198a715a5f9226e">
<span class="previewContent">
<span class="
swatchColours swatchOneColour showPreview
" title="Gray">
<span class="swatchColour swatchColour_1" style="background-color:#5c6e75;"> </span>
</span>
</span>
<input type="radio" class="validation" name="attribute[1214]" value="856" id="be3c11263d03737fd198a715a5f9226e">
<span class="name">Gray</span>
</label>
</li>
<li class="swatch hasPreview swatchOneColour">
<label for="04673f6abfec9ccd392004a6dbecf685">
<span class="previewContent">
<span class="
swatchColours swatchOneColour showPreview
" title="White">
<span class="swatchColour swatchColour_1" style="background-color:#ffffff;"> </span>
</span>
</span>
<input type="radio" class="validation" name="attribute[1214]" value="855" id="04673f6abfec9ccd392004a6dbecf685">
<span class="name">White</span>
</label>
</li>
</ul>
</div>
我正在尝试使用 AJAX 从不同的网页获取此 div 中所有十六进制代码的列表。对 AJAX 有点陌生,甚至不知道从哪里开始。
我试着从这样的事情开始:
$.get('ajax/test.html', function(data) {
$('.result').html(data);
alert('Load was performed.');
});
我从那里去哪里?获取此类数据的最佳方法是什么?并且所有 ID 的值都是由一个变量设置的,所以我不能用它来找到附近的 div。