当我想使用ajax调用提交模式时,我收到此错误。我不知道是什么导致了这个错误。我试过搜索并没有得出任何结果。有人帮助我吗?
function remove_utf8_bom_head($text) {
if(substr(bin2hex($text), 0, 6) === 'efbbbf') {
$text = substr($text, 3);
}
return $text;
}
我的控制器:
my js code in html file
<script src="/js/app.js">
</script>
<script>
$(document).ready(function(){
$('#btn_add').click(function(){
var url = "http://localhost:8000/home";
$('#btn-save').val("add");
$('#frmPost').trigger("reset");
$('#myModal').modal('show');
$('#btn-save').click(function(e){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
})
var formData = {
'title':"sdsdsd",
'description' :"dssdhjsdjs"
}
$.ajax({ //line 28
url: url,
type: 'POST',
data: { userData: formData },
success: function()
{
//alert("Settings has been updated successfully.");
$('#myModal').modal('close');
}
});
});
});
});
</script>