-1
javascript變量我有這樣的代碼存放於下一個變量聲明
<script type = "text/javascript">
$(document).ready(function(){
$(".sub_category").click(function()
{
var main_cat = $("input[name='category_form_cat_1']:checked").val();
var sub_cat_form1 = $("input[name='subcategory_form_cat_1']:checked").val();
$("input[name='subcategory_form_cat_1'][value=sub_cat_form1]").attr("checked",true);
$.ajax
({
data: {'cat':main_cat,'sub_cat':sub_cat_form1},
url: "ajax_files/events-select.php",
type: 'GET',
success: function(data)
{
$("#displayedresults").html(data);
$('#loading_spinner').hide();
$('#loading_text').hide();
$('#loading_row').hide();
$('#displayedresults').show();
//$('.button_export').show();
//$("a.button_export").attr("href", string);
}
});
return false;
});
});
我需要這條線的值存儲在未來一
var sub_cat_form1 = $("input[name='subcategory_form_cat_1']:checked").val();
$("input[name='subcategory_form_cat_1'][value=sub_cat_form1]").attr("checked",true);