Есть форма для фильтрации и показа шин. Он использует данные из баз данных: модель автомобиля, год выпуска автомобиля и так далее. Результаты показаны под формой. Я хочу поместить результаты в URL, чтобы использовать их в фильтре.
<form id="select_form" action="/" method="POST">
<label>Производитель:</label>
<select id="category1" name="vendor">
<?php echo $opt->ShowCategory(podbor_shini_i_diski); ?>
</select>
<label>Марка:</label>
<select id="type1" name="car">
<option value="0">Выбрать...</option>
</select>
<label>Год выпуска:</label>
<select id="year1" name="year">
<option value="0">Выбрать...</option>
</select>
<label>Модификация:</label>
<select id="modification1" name="mod">
<option value="0">Выбрать...</option>
</select>
<input id="sendForm" type="submit" class="button" value="Подтвердить" />
</form>
<div id="result"></div>
Существует также jquery
jQuery(function($) {
var table = "podbor_shini_i_diski";
var show = "3";
$("select#type1").attr("disabled", "disabled");
$("select#year1").attr("disabled", "disabled");
$("select#modification1").attr("disabled", "disabled");
$("select#category1").change(function() {
$("select#type1").attr("disabled", "disabled");
$("select#type1").html("<option>Ждите...</option>");
var vendor = $("select#category1 option:selected").attr('value');
$.post("/auto-parts/select_type.php", {
vendor: vendor,
table: table
}, function(data) {
$("select#type1").removeAttr("disabled");
$("select#type1").html(data);
});
});
$("select#type1").change(function() {
$("select#year1").attr("disabled", "disabled");
$("select#year1").html("<option>Ждите...</option>");
var vendor = $("select#category1 option:selected").attr('value');
var car = $("select#type1 option:selected").attr('value');
$.post("/auto-parts/select_year.php", {
vendor: vendor,
car: car,
table: table
}, function(data) {
$("select#year1").removeAttr("disabled");
$("select#year1").html(data);
});
});
$("select#year1").change(function() {
$("select#modification1").attr("disabled", "disabled");
$("select#modification1").html("<option>Ждите...</option>");
var vendor = $("select#category1 option:selected").attr('value');
var car = $("select#type1 option:selected").attr('value');
var year = $("select#year1 option:selected").attr('value');
$.post("/auto-parts/show_modification.php", {
vendor: vendor,
car: car,
year: year,
table: table
}, function(data) {
$("select#modification1").removeAttr("disabled");
$("select#modification1").html(data);
});
});
$("form#select_form").submit(function() {
var vendor = $("select#category1 option:selected").attr('value');
var car = $("select#type1 option:selected").attr('value');
var year = $("select#year1 option:selected").attr('value');
var mod = $("select#modification1 option:selected").attr('value');
$.post("/auto-parts/shini_show.php", {
vendor: vendor,
car: car,
year: year,
mod: mod,
table: table,
show: show
},
function(data) {
$("#result").html(data);
});
return false;
});
});
И часть кода
if ($zavod_shini != "") {
echo "<TR><TD><h3>Заводская комплектация</h3></TD></TR>\r\n";
$zavod_shini_ = explode('|', $zavod_shini);
for ($j = 0; $j <= count($zavod_shini_); $j++) {
$zav_width_[$j] = substr($zavod_shini_[$j], 0, 3);
$zav_height_[$j] = substr($zavod_shini_[$j], 4, 2);
$zav_diam_[$j] = substr($zavod_shini_[$j], 8, 2);
if ($zavod_shini_[$j] != "")
echo "<TR><TD><a href='../?pa_shirina-profilya=$zav_width_[$j]&pa_vysota-profilya=$zav_height_[$j]&pa_diameter=$zav_diam_[$j]'>".$zavod_shini_[$j].
"</a></TD></TR>\r\n";
}
}
Проблема в том, что я не знаю, как добавить параметры из результата в URL, используя ajax возможно