406 Restcall中不可接受的错误

时间:2015-11-19 07:49:49

标签: javascript java jquery

我正在使用ajax和spring.i我在我的code.upto控制器中创建动态下拉列表我正在获取我的dropdown.now我正在创建一个ajax调用以在我的dropdown上显示动态值。当一个ajax调用我我收到 406 Not Acceptable error

这是我的代码。

@RequestMapping(value = "/envi", method = RequestMethod.POST)
      public @ResponseBody List<Environments> getEnvironmentNames(@RequestParam String selectedaname ) throws SQLException {
        List<org.mvc.domain.Environments> environmentnamesList = loginDelegate.getEnvironments(selectedcustomername);
        System.out.println("envi size"+environmentnamesList.size());
        return environmentnamesList;
    }

这是我的ajax电话。 这是我的控制器

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    if (section==0)
        return headerHeight;
    if (section==1)
        return headerHeight1;
    if (section==2)
        return headerHeight2;
    if (section==3)
        return headerHeight3;
    if (section==4)
        return headerHeight4;
    if (section==5)
        return headerHeight5;
    if (section==6)
        return headerHeight6;
}

-(void)changeHeight {
    UIView *headerSectionView = (UIView *)[mainTable viewWithTag:currentSectionIndex+1];
    [mainTable beginUpdates];

    if (currentSectionIndex ==1)
        headerHeight= updatedValue;
    else if (currentSectionIndex==2)
        headerHeight1= updatedValue;
    else if (currentSectionIndex==3)
        headerHeight2= updatedValue;
    else if (currentSectionIndex==4)
        headerHeight3= updatedValue;
    else if (currentSectionIndex==5)
        headerHeight4= updatedValue;
    else if (currentSectionIndex==6)
        headerHeight5= updatedValue;

    [mainTable endUpdates];
}

提前致谢

1 个答案:

答案 0 :(得分:0)

您需要在两者之间留一个空格:

$('#adropdownDetails :selected').text()

$('#adropdownDetails:selected').text()这可能不是您要寻找的价值。这是whitespace或新行字符。你可以查看下面的代码:

&#13;
&#13;
var selval = $('select:selected').text();
$('pre').html('<p>'+selval+'</p>');
&#13;
p{border:solid 1px grey; padding:2px;}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select><option>select...</option></select>
<pre></pre>
&#13;
&#13;
&#13;