There was an unexpected error (type=Method Not Allowed, status=405). Request
程序员文章站
2022-03-03 17:23:06
...
当使用ajax进行页面提交抛出以上异常,最后结果发现
<form id="newsForm" method="post" enctype="multipart/form-data">
新闻标题:<input name="ntittle"><br>
新闻摘要:<input name="nsummary"><br>
新闻内容:<input name="ncontent"><br>
新闻作者:<input name="nauthor"><br>
发布时间:<input name="ndate" ><br>
图片:<input type="file" name="newpic"><br>
新闻主题:<select name="newsType.ntypeId">
<option value="-1">请选择新闻主题</option>
</select><br>
<input type="hidden" name="nid"><br>
<input type="hidden" name="npic"><br>
<input type="submit" value="添加">
</form>
使用的是AJAX,所以提交就不是直接submit直接提交表单方式了,所以应该使用button,然后表单序列化。
<input type="button" value="添加">
上一篇: [收藏]MySQL常用操作
推荐阅读
-
There was an unexpected error(type=Bad Request,status=400).Required String parameter'username' isnot
-
There was an unexpected error (type=Bad Request, status=400).以及@RequestBody和@RequestParam区别
-
springboot以delete请求方式提交报错There was an unexpected error (type=Method Not Allowed, status=405).
-
There was an unexpected error (type=Method Not Allowed, status=405). Request method ‘POST‘ not suppo
-
There was an unexpected error (type=Method Not Allowed, status=405). Request