这是我在上传成功后使用的功能,当我成功调用此功能时,
<script type="text/javascript">
function upload_submit{{ key }}(id, fileName){
jQuery(".qq-upload-drop-area").hide();
jQuery(".qq-upload-fail").hide();
}
function upload_success{{ key }}(id, fileName, responseJSON) {
var remove_class = 'remove_image_link'
if ( {{ twd.show_leftbox }} && {{ twd.show_rightbox }} )
remove_class = 'remove_image_link_side'
var removeLink{{ key }} = " <a class='text-danger' onclick='RemoveImage(\"{{ key }}\",\"{{ pages.page_title }}\")' href='javascript:void(0)'><i class='fa fa-times-circle "+remove_class+"' ></i></a>";
var html_data;
var imgSrc;
var image_path_http;
if(responseJSON.large_image_name != "" && responseJSON.thumb_image_name!= "") {
html_data = htmlDecode(responseJSON.image_html);
}else{
html_data = responseJSON.large_image_name;
image_path_http = responseJSONimage_path_http;
}
jQuery("#showuploadfile{{ key }}").html(html_data + removeLink{{ key }});
jQuery("#showerrorfile{{ key }}").show();
if({{ key }} == 0) {
imgSrc = image_path_http + '&size=' + selVal() + '&orientation=' + getRadioCheckedValue();
document.getElementById("preview{{cnt}}").src = imgSrc;
document.getElementById("showuploadbutton").style.visibility = "visible";
}
}
</script>
我收到以下错误。有谁知道我为什么会这样? 我在这里使用twig和php
ReferenceError: selVal is not defined
imgSrc = image_path_http + '&size=' + selVal() + '&orientation=' + getRadioCheck...
我也定义了这个功能
function selVal() {
return document.getElementById('rdo_size').options[document.getElementById('rdo_size' ).selectedIndex].value;}