2012-12-10 105 views
0

我有一个模块有三个下拉菜单,在一个类中,具体取决于彼此。我有第一个从MySQL加载数据的下拉菜单。 我希望第二个根据第一个选定的值加载数据。目前,我有这样的代码:Joomla模块和Jquery

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> 
<script type="text/javascript"> 
function curPageURL() { 
    var pathname = window.location.pathname; 
    return pathname; 
} 

$(document).ready(function(){ 
    $('#art1').change(function(){ 
     var $height = $('#art2') ; 
     $height.find('option:not([value=default])').remove(); 
     $.getJSON(curPageURL(), {height:$(this).val()}, function(heights){ 
      $.each(heights, function(index, height){ 
       $height.append('<option value="'+height[0]+'">'+height[1]+'</option>'); 
      }); 
     }); 
    }); 
}); 
</script> 

这正好在default.php,如果高度设置它执行和MySQL的语句从另一个类的正常工作,然后将其编码到json。但萤火虫给我这个错误

ERROR: JSON.parse: unexpected character

和我正在查看数据它是返回一个完整的html代码。

回答