$.ajax({
type: "POST",
url: "../userKvtableAll/bindOpt",
data: "id="+id,
dataType:'JSON', //不加dataType 可能 405 Method Not Allowed这里返回的类型有:json,html,xml,text
success: function(msg){
jQuery('#grid-table').trigger("reloadGrid");
}
});
在spring框架中使用post请求服务,请求成功转到一个静态文件,如html,htm等网页时。页面出现405 request method post not supported错误,需要在spring的配置文件中配置:
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<entry key="/请求的文件路径/**" value="myResourceHandler" />
</map>
</property>
<property name="order" value="100000" />
</bean>
<bean id="myResourceHandler" name="myResourceHandler"
class="org.springframework.web.servlet.resource.ResourceHttpRequestHandler">
<property name="locations" value="/请求的文件路径/" />
<property name="supportedmethods">
<list>
<value>get</value>
<value>head</value>
<value>post</value>
</list>
</property>
</bean>