Hello, I need a popular select so they are dynamic. The customer is a car site, that is, the user can schedule the cars.
My work is popular select, however I'm having difficulties because XML seems to me poorly structured ...
I will have 4 selects city, store, brand and car.
That is, if the user selects São Paulo, it will show only the stores and cars available in sp ...
But, I think XML is poorly organized, because it returns the name of the city more than once ...
Below is the code ...
<entry>
<g:id>109851</g:id>
<title>FIAT UNO 1.0 FIREFLY FLEX ATTRACTIVE 4P MANUAL</title>
<g:description>Nenhuma descrição encontrada.</g:description>
<link></link>
<g:image_link></g:image_link>
<g:availability>in stock</g:availability>
<g:price>34290 BRL</g:price>
<g:google_product_category>916</g:google_product_category>
<g:brand>FIAT</g:brand>
<g:identifier_exists>no</g:identifier_exists>
<g:condition>used</g:condition>
<g:adult>no</g:adult>
<g:is_bundle>no</g:is_bundle>
<g:color>PRATA</g:color>
<state>Minas Gerais</state>
<city>Belo Horizonte</city>
<store>Belo Horizonte - Estoril</store>
</entry>
In each entry there is a city, and if I look for this city with the jquery fetch, it returns me all the cities of all the entrys (the same city about 100 times) ...
The correct thing would be for me to ask them to rephrase this XML? or is it possible for me to turn around with him?
// edit
My code
$.ajax({
type: "GET",
url: "googleshoppingcustom.xml",
dataType: 'xml',
success: function(xml){
$(xml).find('entry').find('state').each(function(i){
var state = $(this).text();
$('#region').append('<option value=${state}>${state}</option>')
)}
My real problem is not even this repetition ... but how could I get EVERY car brand for EVERY car ... I find the xml a bit messy ...
strong>