我想要一个AJAX帖子请求。所以,我有一个是喜欢它 -
$(document).ready(function()
{
var baseURL = $('meta[name=base_url]').attr("content")+'/';
var lastClicked = 0;
var token = $('meta[name=csrf_token]').attr("content");
$( "#button_yes,#button_no" ).click(function()
{
var now = new Date();
if(now - lastClicked > 10000)
{
lastClicked = now;
console.log('Done');
$.ajax(
{
headers: { 'X-CSRF-TOKEN': token},
url: baseURL+"add_votes",
success: function(result)
{
alert(result);
console.log(result);
console.log(token);
},
method: "POST",
data:
{
_token: token,
uuid : $('meta[name=webniar_ID]').attr("content")
},
});
}
});
});
所以,更具体地说 -
$.ajax(
{
headers: { 'X-CSRF-TOKEN': token},
url: baseURL+"add_votes",
success: function(result)
{
alert(result);
console.log(result);
console.log(token);
},
method: "POST",
data:
{
_token: token,
uuid : $('meta[name=webniar_ID]').attr("content")
},
});
但我得到 407错误
有人可以帮助我吗?