我有控制器的请求映射
@RequestMapping(value = "/signupforflashsale", method = RequestMethod.POST)
@ResponseBody
public boolean signupForFlashsale(@RequestParam(value = "email") final String email)
{
......
}
我使用以下网址访问此映射: http://local.test.com:9001/email
但是我收到以下错误:
POST http://local.test.com:9001/view/EmailSignUpAddressComponentController/signupforflashsale 403 (Forbidden)jquery-1.7.2.min.js:4 f.support.ajax.f.ajaxTransport.sendjquery-1.7.2.min.js:4 f.extend.ajaxflashsale.js:8 registerForFlashSaleVM2133:1 (anonymous function)
以下映射http://local.tumi.com:9001/email调用java脚本函数javascript:registerForFlashSale()以使用ajax调用访问控制器方法signupForFlashsale。
这是jsp表单,其中包含电子邮件值和两个按钮。
<form id="FlashSaleForm" name="flashSaleForm" action="javascript:registerForFlashSale();" method="POST"><div class="ctnr-input-with-button">
<input id="emailid" name="email" placeholder="Enter your email" type="text" value=""><button type="submit" id="signupforflashsale" class="btn btn-v-1" value="/c/flashsale">
Submit</button>
<a href="www.google.com"><button type="button" id="nothanksforflashsale" class="btn btn-v-1">
No Thanks</button>
</a>
</div>
<span id="responseSuccessMsg" style="display: none;">Thanks for signing up <br> Keep an eye on your email for info about our new products and deals</span>
<span id="responseAlreadySignedUp" style="display: none;">Already signed up</span>
<span id="responseErrorMsg" style="display:none">Thanks for signing up but there is error occured. Please try again!!!</span>
<span id="responseInvalidEmail" style="display: none;">Invalid format. Email address must contain @-symbol and domain extension</span>
<input type="hidden" name="CSRFToken" value="9ab43f55-9580-4961-bdd7-d753e4346705">
</form>