这里是一个按钮:
<input type="button" value="add to cart" id="addToCart" />
和绑定事件:
$("#addToCart").bind('click',function(){
$.ajax({
url: '/cartManager/add',
data:{
pictureId: currentImageId,
printSize: $("#size option:selected").val(),
paperType: $("#paperType option:selected").val(),
quantity: 1
},
success: function(){
$("#modal").html("<h1>ОК</h1><p>Closing in a sec</p>").delay(1000);
$("#modal").overlay().close();
}
});
return false;
});
,一切工作发现除了一两件事,那种麻烦事了,我看到在Chrome开发者控制台两个请求此:
- 添加/ cartManager:
Request URL:http://127.0.0.1:8000/cartManager/add?pictureId=4&printSize=2&paperType=1&quantity=1 Request Method:GET Status Code:301 MOVED PERMANENTLY
- 添加/ cartManager /加?:因为这两者都是大同小异的,在请求的头部唯一的区别
Request URL:http://127.0.0.1:8000/cartManager/add/?pictureId=4&printSize=2&paperType=1&quantity=1 Request Method:GET Status Code:201 CREATED
请求头:
首先是cartManager/add?pictureId =和s o和第二个是cartManager/add /?pictureId - '/'after/add
我的javascript有什么问题吗?
我不明白为什么它会打扰你,利比亚局势困扰我。这是预期的行为。 – Anders 2011-04-04 21:15:36
如果将最终/添加到网址,会发生什么情况?网址:'/ cartManager/add /' – fredrik 2011-04-04 21:16:40